How to add to an existing hash in Ruby

If you have a hash, you can add items to it by referencing them by key: Here, like [ ] creates an empty array, { } will create a empty hash. Arrays have zero or more elements in a specific order, where elements may be duplicated. Hashes have zero or more elements organized by key, … Read more

How can bcrypt have built-in salts?

This is bcrypt: Generate a random salt. A “cost” factor has been pre-configured. Collect a password. Derive an encryption key from the password using the salt and cost factor. Use it to encrypt a well-known string. Store the cost, salt, and cipher text. Because these three elements have a known length, it’s easy to concatenate them and store them … Read more

What is a hash function in java?

The Wikipedia article will have a lot of technical information, but a simplistic view of hashing is something like the following. Imagine that there’s a magical function that can give a number to any object. Given the same object, it always return the same number. Immediately now you have a quick way to test if … Read more

Create your own MD5 collisions

These following two different 128 byte sequences hash to the same: MD5 Hash: 79054025255fb1a26e4bc422aef54eb4 The differences below are highlighted (bold). Sorry it’s kind of hard to see. d131dd02c5e6eec4693d9a0698aff95c 2fcab58712467eab4004583eb8fb7f89 55ad340609f4b30283e488832571415a 085125e8f7cdc99fd91dbdf280373c5b d8823e3156348f5bae6dacd436c919c6 dd53e2b487da03fd02396306d248cda0 e99f33420f577ee8ce54b67080a80d1e c69821bcb6a8839396f9652b6ff72a70 and d131dd02c5e6eec4693d9a0698aff95c 2fcab50712467eab4004583eb8fb7f89 55ad340609f4b30283e4888325f1415a 085125e8f7cdc99fd91dbd7280373c5b d8823e3156348f5bae6dacd436c919c6 dd53e23487da03fd02396306d248cda0 e99f33420f577ee8ce54b67080280d1e c69821bcb6a8839396f965ab6ff72a70 The visualization of the collision/block1 (Source: Links.Org) The visualization of the … Read more