## Hashing Algorithm Custom Implementation

I’m a computer engineering student and I want to implement a cryptographic function for a college project. I want to realize my personal implementation of a WPA2 hash producer in C (and upload it to my FPGA). The main goal would be to use such FPGA as an alternative to Hashcat in bruteforcing passwords.

To do so, I need various implementations of Cryptographic Hash Functions such as SHA1 and HMAC-SHA1 and, while writing down the code, peeking into Hashcat’s open source code and other users’ custom code, I noticed that in both of them, the implementation followed a precise standard:

• sha1_init
• sha1_update
• sha1_transform
• sha1_final

I haven’t found any specific implementation standard across the web so I was wondering if you had any information about this: is the above-mentioned standard a thing? If so, where can I find some guidelines about it?

## In perfect hashing, why does a secondary hash table quadratic in size lead to no collisions?

I read the following in CLRS 3rd Edition (Section 11.5, “Perfect Hashing“):

How does the choice of $$m_j = n^2_j$$ lead to no collisions?

## Universal hashing – insert / search / delete

I don’t understand the highlighted text below in CLRS 3rd Ed.:

What do they mean by “containing $$\mathcal{O}(m)$$ INSERT operations“? What contains them? And why $$\mathcal{O}(m)$$?

## How are hashing algorithms useful if the implementation is public?

I may be misunderstanding, but if I want to use a hashing algorithm such as argon2, what’s stopping from someone seeing how it works and reversing what it does?

## Is the half_md4 dirent hashing algorithm a security problem in ext* filesystems?

half_md4 does not look a very strong hash for me, although googling for it does not reveal too much.

I suspect, the directory entries could be organized by a half_md4 hashed hash table.

If it is so, then creating multiple file namesace having the same hash (or, having different hash, but going into the same bucket) on an ext4 filesystem would not be very hard.

And, considering that most directory operations are atomic in most OSes, it could be used for DOS attacks. For example, any website where documents could be uploaded and stored in the server-side filesystem, could be slowen or even die with it.

Is it a possible danger? Does ext4 has some inherent protection against it?

## user password authentication and cracking password – multiple rounds of hashing

when multiple rounds of hashing are performed, why is it that john the ripper cannot crack hashed passwords? (multiple rounds of hashes basically). On the other hand, the system can, however, authenticate a user even when passwords are stored using multiple hashing. how does it do that? is it that John the ripper can only crack 1 level of the hashed password. and the system just matches the hash to the database or something?

## Static Perfect Hashing – FKS

I am trying to understand perfect hashing aka FKS, but I have a few questions.

From my understanding, perfect hashing is a two level hashing in which you take a hash function from a universal family of hash functions, and hash a key to a specific slot in a hash table. At this step there might be collisions and that’s why we apply a second hash function to the key and we store as the value another hash table of size at most 2n.

My questions are:

1. Do we have two hash tables? Can we have 1 array and 1 hash table?
2. Can the 2 hash functions used have different inputs? Meaning can I pass different keys to each hash function?

For example, I have a string and I would like to store it in a dictionary using static perfect hashing. Can I do the following? :

1. Have a hash table (A) that will store a counter that will be incremented and will be at max n. The counter will be used as the index where the string starts, for example, if the string is “hello”, and the counter= 2, the string will be modified and started from index 2, so the string will be “llo”. Therefore A will be of size n and will have as keys the counter, and as values it will have hash tables (B_i).

Then B_i will store as keys the character of the string and as values the position of each character with regards of the counter.

2. Have a hash function that will be used to map the position of the character in the string to a specific slot in the hash table (A)
3. Have a second hash function that will map each character in the string to a slot in the second hash table B_i.

Is that a valid way of performing static perfect hashing? Could I remove the first hash function and turn the first hash table (A) into a simple array (since at the first stage I am only interested in the index/position of the characters in the string?

## Hashing sensitive data and checking for duplicates

I have some sensitive client data that needs to be hashed, but I also need to check that that data isn’t duplicated by another client. So the hash function needs to produce the same value for the same data so I can search the db for duplicates.

One option is brcrypt with a constant salt but that isn’t very secure.

Any ideas?

## What’s the algorithm behind MySQL’s sha256_password hashing scheme?

MySQL’s old mysql_native_password hashing scheme was the equivalent of this in PHP:

sha1(sha1('password', true)); 

That’s a hex-encoded SHA-1 hash of a binary SHA-1 hash of the password, without any salting.

MySQL 8.0 introduced a two variants of a new hashing scheme based on SHA256 called caching_sha2_password and sha256_password, the former being the default (docs. Despite their name, neither appears to be vanilla SHA256.

Yes, I know SHA256 is not a great choice for password hashing, but it’s a lot better than SHA-1 and it wasn’t up to me!

Can anyone tell me the actual algorithms for these new schemes, in PHP or similar code?

## How a chosen prefix collision is more useful than a standard collision concerning hashing functions?

Recently a paper has been released about SHA-1 chosen prefix collision.

They present what a chosen prefix collision is, but I don’t understand how is it more interesting than a standard collision ? They briefly mention x509 rogue certificate, but I still can’t get the point.

Can anyone explain to me how interesting it is compared to standard collisions ? Hopefully with an example a bit more detailed ?