We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [hashcode]

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

Filter by
Sorted by
Tagged with
4
votes
1answer
305 views

Generating Signatures of Tree Structures using an Order-Independent Hash

I'm working with a file format which stores data as a tree. Each node in the tree is known as a Tag, and every tag has a name ...
-1
votes
1answer
274 views

Simple example of a hash table using square as key

I'm studying hash tables, and wrote the following to serve as a simple example. Does this properly demonstrate the basic concept of a hash table? The values are ...
1
vote
4answers
2k views

Java class to compute and get a MD5 hash as a string

Here is my class file to compute MD5 hashes on a file. I wanted to be able to easily calculate them without having to create a lot of overhead in the code using the class. Can anyone tell me a list ...
2
votes
2answers
178 views

Find combination of sets which sum up to a specified result

Example input : A) 1, 2 B) 2, 8 C) 7, 8 Required Result : 8, 10 The output from the program with this input should be A + C. Few notes : We can only combine 2 sets. There must ...
1
vote
0answers
99 views

Minimal length of substring that forms cyclic string

there is a knows problem stated as "Cyclic string": A string S has been recorded many times, and then from the resulting line took a substring, and give to you.Your task is to determine the minimum ...
5
votes
1answer
1k views

Generating unique ID of an exception

For classifying error reports, I need to generate an ID from an exception. That ID should be (more or less) unique a short alpha numeric string equal for equivalent exceptions (even on different ...
2
votes
1answer
417 views

Hash function for a key of type structure

I need to implement a hash function for a key of type structure. This structure is as follows: ...
1
vote
1answer
105 views

Finding a passcode by comparing MD5 result

This function finds the 8 char passcode from a given "doorId". Is there a way to find the passcode in an undetermined number of steps without using a while? Maybe ...
5
votes
1answer
124 views

2016 Advent of Code - Day05

Day 5: How About a Nice Game of Chess? You are faced with a security door designed by Easter Bunny engineers that seem to have acquired most of their security knowledge by watching hacking ...
8
votes
1answer
2k views

Extending CGPoint to conform to Hashable

For Advent of Code Day 1, I found myself needing to use a tuple as a key in a dictionary. Seeing that I can't extend tuples in Swift, I decided to extend CGPoint ...
0
votes
1answer
178 views

myhash - library with hash functions

I had a file with 2 hash functions (DJB2, NMEA0183), written in C-like way, e.g. something like this: ...
4
votes
2answers
2k views

Automatic IEqualityComparer<T>

There are APIs like the Except extension that require the IEqualityComparer<T> to work. I find it's too much work for such ...
1
vote
1answer
146 views

Quadratic probing and hashing - search for words in text files

I created a program for a college class. After I got it working, I wanted to improve it. As a beginner, it is probably a mess. Description It uses a HashFunction ...
5
votes
2answers
4k views

Short script to hash files in a directory

What improvements could be made to this script and can you explain why you would make those changes? ...
8
votes
1answer
2k views

Duplicate files finder in C++

I've came across this question https://stackoverflow.com/questions/11760420/what-is-an-optimal-way-to-find-duplicate-files-in-c and there are two answers for it both the answers convey that it is bit ...
4
votes
1answer
3k 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
4k 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 ...
2
votes
3answers
6k 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? ...
6
votes
1answer
5k 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 ...
3
votes
4answers
2k 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: ...
4
votes
1answer
105 views

Password and shadow file mockup

I tried to implement something similar to the Linux shadow.txt file and I am not aware of concepts such as memory fingerprinting. Could someone please review this code? ...
7
votes
2answers
7k 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 ...
10
votes
2answers
237 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
2k 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
1k 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
1answer
874 views

Create MD5 hash list of big memory mapped files

I wrote this class: ...
3
votes
2answers
73 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
962 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 ...
5
votes
1answer
3k 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
7k 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
836 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 ...
3
votes
3answers
332 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 ...
4
votes
2answers
237 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
125 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
188 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
162 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 ...
8
votes
1answer
20k 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
78 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): ...
8
votes
1answer
183 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
768 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,...
4
votes
2answers
10k 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
212 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 ...
2
votes
1answer
93 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
1k 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
2k 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? ...
6
votes
0answers
342 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? ...
8
votes
1answer
15k 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 ...
8
votes
1answer
411 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
916 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
126 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. ...