Hashcode is a result of applying a hash function to data, usually an integer.

learn more… | top users | synonyms

2
votes
1answer
97 views

GetHashCode of a Dictionary

There is a huge documentation about using and generating hashcodes for objects that will go into a dictionary, really few more if you try to look about hashcode of a dictionary. No, the default ...
1
vote
2answers
128 views

Hash calculation for array of long values in C#

Can the following function be improved in terms of performance? I am calculating millions of such hashes. The long array represents a record from data table where all values are encoded as long ...
0
votes
0answers
51 views

Hashing passwords with crypto in Node.js

Going through my old files today, I found this code which I wrote a year ago after being asked by my professor to create a "secure" encryption, decryption and password hashing functions. ...
2
votes
3answers
70 views

String hash generator

There is a lot of code duplication because it generates hashes using multiple cryptographic hash algorithms. How can I improve this code? ...
2
votes
1answer
146 views

Hashing a tuple in C++17

C++ doesn't supply a std::hash<std::tuple<...>>, so I decided to implement one. However, I was viewing this as more of a hash library than extensions to ...
2
votes
3answers
57 views

Optimizing Java SHA-512 String-to-Hash Generator

In an attempt to learn Java and SHA-2 I created a very simple String-to-SHA512 generator. Here is the code: ...
3
votes
0answers
47 views

Password & Shadow File Mockup

I tried to implement something similar to linux shadow.txt file and I am not aware of concepts such as memory fingerprinting. Could someone please review this code : ...
4
votes
2answers
173 views

Unit testing Equals, hashcode and comparator - asserting contracts

After reading Joshua Blosh's Effective Java 2nd edition, I decided to implement equals, hashcode and comparable(where applicable) to every class I have been implementing. I have written a generic ...
9
votes
2answers
148 views

Finding a string whose MD5 starts like the digits of π

I tried to make a program to find a string whose MD5-hash starts like the digits of pi, where dot is omitted. Is there a faster way to do it than this: ...
11
votes
2answers
1k views

One-way hash using ASCII

Assume the built-in function Ascii(c), where c is a one character string, will return an integer containing the ASCII value of ...
2
votes
1answer
131 views

Compile-time string hash

A while back this question proposed a constexpr compile-time Sieve of Eratosthenes. It also linked to another SO question about compile-time computation of CRCs. I'...
3
votes
2answers
51 views

Finding a pair of words from two files with a particular MD5

I have two txt files. Both contain 60k+ words in a list. I put together some code to loop through each file and concatenate the strings ...
5
votes
2answers
864 views

What’s the largest MD5 hash you can find?

I got inspired by Doorknob's blog post What’s the largest MD5 hash you can find? to get my hands dirty and learn some Python. After playing around with the code from that post, I decided to rewrite ...
4
votes
1answer
1k views

Implementing the Hashable Protocol in Swift with the DJB hash function

A while back I made a custom String struct (see github repo) because of the difficulties in dealing with Mongolian Unicode rendering when using Swift String or <...
3
votes
1answer
622 views

Hash function for strings

Implementation of a hash function in java, haven't got round to dealing with collisions yet. I tried to use good code, refactored, descriptive variable names, nice syntax. My code must be efficient ...
5
votes
1answer
135 views

Image duplicate finder

I have a bunch of exact-duplicate pictures that I've acquired over the years. I'd like to create a list of all them so I can eventually delete some. My idea was simple: dump the hash and location of ...
2
votes
2answers
88 views

A hash-signature-type which tests on comparing against normal strings

I decided to throw this together today figuring it would be cool to add to my repertoire. Before we always had performed this "task" externally. Find the value we want to compare, hash it and compare ...
1
vote
1answer
77 views

Wrapper class for adding elements to HashSet

I have many object of class Test. I want to be sure that among them, there are no two objects o1 and ...
1
vote
1answer
90 views

Java hashcode without using the Object#hashCode method

For an assignment I have to make a HashTable using double hashing, but for the hashing part I am not allowed to use ...
2
votes
1answer
63 views

Harnessing hashCode as JAXB @XmlID in order to use it with @XmlIDREF

I have a class Fighter in a software for planning boxing events. I implemented its hashCode() and ...
2
votes
2answers
84 views

Java hashCode method in VB.NET

The point of this method is to emulate Java hashCode(). In order for this to work the project must have arithmetic overflow allowed under: project --> compiler ...
6
votes
1answer
5k views

Checking for differences between two (large) files

I want to write a relatively simple program, that can backup files from my computer to a remote location and encrypt them in the process, while also computing a diff (well not really...I'm content ...
0
votes
1answer
49 views

Hashing an arbitrary object to a sparse array of bits

I have this method in one of the java classes I'm working on (an implementation of a counting bloom filter): ...
6
votes
1answer
102 views

One way encoding a password

I wrote a script that one way encrypts a user's password by generating a key, and multiplies by the ASCII value of the character and the ASCII value of the key character at (the position that the ...
5
votes
1answer
286 views

Implementation of the FNV-1a hash algorithm for 128-, 256-, 512- and 1024-bit

A little over a year ago, I asked this question. Since then, I've implemented the larger bit variations and am looking for any and all feedback - performance is obviously key when talking about FNV-1a,...
3
votes
2answers
4k views

Encrypting and decrypting passwords in PHP

I am wanting to encrypt a password and decrypt a password using PHP. Is this a safe method? ...
4
votes
1answer
161 views

Truncate 160-bit output from SHA-1 to 64-bit uint64_t

I'd like to truncate 160-bit output from SHA-1 to receive a (weaker) 64-bit digest. It has been a while since I did the type of low-level C pointer arithmetic in the but-last line. Could you please ...
3
votes
1answer
86 views

Find files with similar contents

I'm not normally a C programmer but thought I'd take a shot at making something useful. This is a C utility I wrote to judge how similar several files are using the algorithm I think ...
4
votes
2answers
443 views

Pairing anagrams in a string list

The task was to check for pairs of anagrams in a string list. I first sorted all the words. and looped over the letters. The interview continues with a follow-up, to do the same with limited memory. ...
5
votes
2answers
810 views

Hash Binary Tree Map

I made a map based on a binary tree ordered by hashcodes, with collisions fixed with equals(). Are there any improvements I could make? ...
5
votes
0answers
134 views

Fowler–Noll–Vo hash function in Lua

I recently coded this FNV-1a hash function in Lua. Are there any apparent performance improvements that could be implemented? ...
7
votes
1answer
6k views

Merge two linked list

Given two linkedlist, merge them. Looking for code review, optimizations and best practices. The code is influenced by feedback here. Changes incorporated were: Linkedlist is no-longer write-only ...
7
votes
1answer
260 views

Enhancing speed of looping cycle using Freepascal

I use Lazarus 1.2.4 and Freepascal 2.6.4. I have created a program that reads a disk in buffers of 64Kb (tried various buffer sizes) using a repeat...until loop. Each buffer is hashed using the SHA1 ...
4
votes
1answer
511 views

Generating random and secure CSRF tokens

I googled around for secure random number generation and random string generation, combining them with some user data. Is this good or am I totally off-base? I don't know much about cryptography but ...
5
votes
1answer
76 views

Eliminating repetitiveness in code to test hash functions

I usually take my school code as a playground to mess around with things. I was given a bunch of premade hash functions and had to test their output and find when they reach a specific lower range. ...
10
votes
2answers
2k views

Override equals() and hashCode() using reflection

I wrote a utility method to override equals() using reflection. This works fine, but I wonder if this code will pass all the tests. ...
2
votes
1answer
159 views

Hashing a password

Does this look like a good method to hash a user password? I'm not very familiar with how this whole hashing process works and below is a bunch of stuff I've seen on many different posts. My main ...
4
votes
1answer
57 views

A PHP Toolkit of some functions

Any major security risks? And please don't get angry over my novice log system. ...
5
votes
1answer
3k views

Implementation of the FNV-1a hash algorithm for 32- and 64-bit

Are there any improvements to these two classes which implement FNV-1a for hashing? Particularly, I'm looking for any reuse opportunities (possibly via a common abstract superclass derived from ...
4
votes
3answers
388 views

Anything wrong with this equals and hashCode implementation?

The below is the domain class called WordType which has Id as its unique DB generated value and Name and Description as other values. I was going through the 'Effective Java' resource by Joshua ...
2
votes
2answers
234 views

Computing hash of string

I want my code to be reviewed and I'd like to hear your opinions. Sun's code to compute hash of string: ...
2
votes
3answers
313 views

Retrieving current time and computing a hash value

Can someone critique this Java code? ...