Hash how to make hash

Hash how to make hash

What are Hash Functions and How to choose a good Hash Function?

What is a Hash Function?

A function that converts a given big phone number to a small practical integer value. The mapped integer value is used as an index in the hash table. In simple terms, a hash function maps a big number or string to a small integer that can be used as the index in the hash table.

What is meant by Good Hash Function?

A good hash function should have the following properties:

For example: For phone numbers, a bad hash function is to take the first three digits. A better function is considered the last three digits. Please note that this may not be the best hash function. There may be better ways.

In practice, we can often employ heuristic techniques to create a hash function that performs well. Qualitative information about the distribution of the keys may be useful in this design process. In general, a hash function should depend on every single bit of the key, so that two keys that differ in only one bit or one group of bits (regardless of whether the group is at the beginning, end, or middle of the key or present throughout the key) hash into different values. Thus, a hash function that simply extracts a portion of a key is not suitable. Similarly, if two keys are simply digited or character permutations of each other (such as 139 and 319), they should also hash into different values.

The two heuristic methods are hashing by division and hashing by multiplication which are as follows:

How to Make Hash Easy With Trimmings, Kief or Buds

We’re always looking for ways to add to the cannabis experience. Adding a little bit of hash to your bowl or joint is always sure to do the trick.

Is it something that’s easy to make at home? What’s the easiest way to make hash?

Today, we’ll take a look at these questions, as well as, where hash came from, and how to make hash.

A Trip to the Past with Hash

Human usage of hash has a storied history. Cannabis is one of the first plants to be referenced in ancient texts. Our human ancestors highly lauded the plant for its versatility.

They used cannabis to create rope, textiles, living quarters and consumed the plant for food.

With the advent of cooking over fire, our ancestors learned that burning some strains of cannabis would result in psychoactive side effects.

What our ancestors didn’t know then was that they discovered tetrahydrocannabinol (THC), the cannabinoid that’s responsible for the high feeling you get from marijuana.

Thrive Leads Shortcode could not be rendered, please check it in Thrive Leads Section!

Hash Becomes Hashish

On top of being smoked, cannabis became commonly used in foods and teas.

During that time, what we now know as marijuana was gaining popularity with early civilization.

Our ancestors felt the high that was created from the plant was a way to help themselves travel inward. Once our ancestors became one with themselves, they were then open to become one with their gods.

This spiritual uplifting made cannabis a staple in early religious ceremonies.

By 900 AD, cannabis had become a commonplace all through Arabia. It’s there where the word hashish, which translates to “grass” in Arabic, was born.

Hash how to make hash. Смотреть фото Hash how to make hash. Смотреть картинку Hash how to make hash. Картинка про Hash how to make hash. Фото Hash how to make hash

The Birth of Hashish

Once cannabis situated in Arabic countries, the natives facilitated the creation of hash. At this time, the native Arabs would take the plant and rub it in between their hands.

Through the use of friction, the static electricity they created between their hands would cause the cannabis to create resin. Resin is the black soot that remains once you light marijuana.

Instead of resin outlining a bowl, native Arabians would have the resin residue caked on their hands.

They would then peel the resin off their skin by rolling it into balls that they named “charas.”

The Science Behind Hash

While you can still make hash by rolling your hands together, hash today is made a lot differently.

Before getting into the different methods, it’s good to understand a few things our ancestors weren’t fully aware of.

Hash comes from the oils that live within the flowers of cannabis.

If you look closely at a bud, you will notice tiny hairs. Those are called trichomes. Within the trichomes live organic compounds called terpenes.

Terpenes are the chemicals that give marijuana the dank, skunky smell often associated with cannabis.

Hash how to make hash. Смотреть фото Hash how to make hash. Смотреть картинку Hash how to make hash. Картинка про Hash how to make hash. Фото Hash how to make hash

Why Hash Makes You Higher

While terpenes are responsible for the smell that lingers from a freshly lit bud, they also contain a multitude of cannabinoids.

Cannabinoids are chemical components that give cannabis its therapeutic effects. The most well-known of the cannabinoids is tetrahydrocannabinol (THC), the psychoactive component of marijuana.

Much like how essential oils work for therapy when you extract oil from the innermost parts of a bud, it contains higher concentrations of the chemicals that comprise the plant.

Therefore, when you extract hash from the resin within the flower, you’re going directly to the THC.

On average, one joint has a level of 8% THC content while hash can contain upwards of 40% THC potency.

From Flower to Kief

As mentioned above, ancestors use to make a black, tarry mess of their hands to extract the oils from cannabis plants to make hashish. Creating hash is simple enough for anyone to do at home.

Essentially, hash comes from separating the trichomes from the flower. When the trichomes are separated, the little particles of dust that lie in its wake are called kief.

With a large quantity of raw kief, the hash then undergoes treatment that will cause the hairs to pop open and release the oils from inside these proteins.

The Many Forms of Hash

While there are mainly two different ways to extract the oils from the cannabis plant, many other factors come into play when it comes to the handling of the kief and the finished product.

For instance, any trichomes that come off of your bud can be used as kief.

No matter where on the plant these trichomes lived, they still carry levels of THC and cannabidiol (CBD), the healing component in marijuana. However, not all areas of the plant are created equal.

For instance, stems and seeds do have traces of THC and their hairs may be added to the kief. Yet, they still carry lower levels of THC than the actual bud and its trimmings.

How to Collect Kief While Smoking Cannabis

Hash how to make hash. Смотреть фото Hash how to make hash. Смотреть картинку Hash how to make hash. Картинка про Hash how to make hash. Фото Hash how to make hash

When you break up cannabis with a grinder, or use your finger to sprinkle the weed into whatever you’re smoking with, collect any little dust that remains on your fingers or in the grinder.

This is the kief you will use to make hash. Usually, if you have a four chamber grinder, just leave the bottom chamber alone because the kief will slowly accumulate.

It will take awhile before there is enough kief made this way to make hash.

How to Make Kief with a Silk Screen

To do this method, you are going to need either a kief box or a couple of screens at varying sizes. Place a large piece of paper underneath the area you are sifting to catch any loose materials.

As you complete each sifting event, fold the paper and move to the next sized screen.

To start, place the kief onto the screen and with a sturdy card, move the plant back and forth. Continue this process until no more kief passes through.

If you’re using a screen box, move the first screen to the side and do the same process on the second screen until you have used all the screens.

You can also just break your bud up in your kief box and let it naturally build up over time.

How to Make Kief with a Blender

The blender is a more scientific method.

Place kief, water and ice in a blender. The reason for ice is that when trichomes are cold, it’s easier to separate them.

When you turn on the blender, the trichomes separate from the flower.

The density of the trichomes are higher than the water, so they sink to the bottom once the blender is shut off.

Through a sifter, transfer the water/trichome mixture into a jar and let sit. Again, the trichomes will separate and float to the bottom.

Freeze the water/trichome mixture for ten minutes. Finally, pour the mixture through a coffee filter to separate the kief and water.

From Kief to Hash

Now that you know how to get kief kief, you’re ready to turn the little dustings into potent hash.

Just like there are many ways to collect kief, there are different ways to make hash. For most larger scale operations, the process involves machinery and the use of solvents.

However, this isn’t always practical or safe for home use.

In general, there are two popular ways to make hash, either with pressure or with heat. However, there is a third that we must not ignore; the tried and true way. the hand method.

How to Make Hash with the Hand Method

As we mentioned, there are different ways to go about making hash.

For one, you can do as your ancestors did—by rubbing your hands together.

When the heat starts to form between your hands, you will notice a sticky, thick coating of black soot on your hand.

Take your sooty kief and roll it around between your fingers to make the “charas” that our Arabic ancestors did. When you’re doing this, you’re creating a low-grade hash.

The reason for the decreased quality of the product is that the oils, dirt and bacteria living on your hands is being transferred into your hash, altering its chemical composition.

How to Make Hash with a Pollen Press

Pressure is essential in creating hash because, in order to extract the oils from the cannabis, you must apply force onto the trichomes.

Using a pollen press, put a weight into the shaft.

Pour the kief on top of the weight and then place a second weight on top of the kief. Take the T-press and wind it down. Open up the compacted kief and add more.

Continue this process until you have a solid hash puck.

While this is an easy method and it doesn’t change the flavor and consistency of the kief, some don’t consider this as true hash because there is no heat involved.

How to Make True Hash with Heat and Pressure

Set your oven to 350° F and pack your kief tightly into cellophane. Wrap the cellophane-covered kief in a paper towel and tape the package shut.

To avoid burning, run the paper-covered kief under warm water and place into the oven.

After 10 minutes, take out of the oven.

Use a rolling pin to apply even pressure over the hot kief. Once flattened, place in the fridge to solidify. From there take off your “charas” from the solid kief.

What is the Easiest Way to Make Hash with Plant Trimmings?

Perhaps the easiest way to use trimmings is to make bubble hash.

It requires no use of fire or solvents. All you need is a bucket, some ice (there’s also a dry ice method outlined later), water, kief and bubble bags.

What are Bubble Bags?

A bubble bag is a bag lined with mesh that works as a filter for plant matter. Bubble bags come with mesh holes of various sizes.

These different sized holes allow for finer screenings of plant matter. The size of the holes in the bag are indicated by the micron number. 220 is the largest number micron.

Known as the “worker bag,” 220 bags collect everything from stems to resin.

That’s why when you make bubble hash, this should be the last bag to cover the bucket.

The smallest micron collects the most resin and filters out most of the plant material. Therefore, it should be the first one you place in the bucket.

How to Make Bubble Hash

Put a bucket down (around 5 gallons). If you’re using a 1-gallon bucket bubble hash machine, divide all future measurements by 5.

Place the mesh bag with the smallest micron around the opening of the bucket.

Depending on how many bags you use, place the next size up inside one another until you reach the largest micron.

How to Use Make Dry Ice Hash

Before handing dry ice be sure to put on gloves so your skin doesn’t touch the dry ice. Take your kief and 3 pounds of dry ice and pour into a 5-gallon bucket.

Place a 73 bubble bag around the mouth of the bucket and shake up to 4 minutes.

Flip the bucket so that everything falls into the mesh part of the bag. Now, take off the bag and shake until you don’t see any more resin falling.

Pour the content of the bag over a clean surface. Use an ice scraper to collect hash. Although it would be less potent than the 72 bag, you can repeat this process with this hash on a 160 bag and then 220 bags.

Conclusion

Learning how to make hash can be intimidating.

There are a ton of different methods, and some require an intimate knowledge of chemistry that most of us just don’t have.

Here are some of the easiest ways to make hash:

None of these require commercial grade equipment, or put you at risk of burning your house down!

Have you ever made hash? Did you try any of these methods? Let us know how they went in the comments section below!

What is hash and how do you make it?

Hash how to make hash. Смотреть фото Hash how to make hash. Смотреть картинку Hash how to make hash. Картинка про Hash how to make hash. Фото Hash how to make hash

Hash how to make hash. Смотреть фото Hash how to make hash. Смотреть картинку Hash how to make hash. Картинка про Hash how to make hash. Фото Hash how to make hash

Hashish or just hash, is a potent cannabis concentrate made by extracting the resin from cannabis plants and working and pressing it into solid form. It can take the form of spheres (like Nepalese temple ball hash), bricks or “cakes” like the hash made in North Africa and the Levant, and dark, sticky fingers or balls like the charas popular throughout the Indian subcontinent.

Which hash is the finest depends on who you ask. There are those who prefer the dark, sticky charas of the Himalayas or the potent hash of many an Afghan mountain valley, while countless people – especially in Europe – swear by sweet, often blond Moroccan hashish. Whichever hash you have, it should have a fragrant, rather spicy aroma, an earthy flavor, and a high that makes you want to curl up with a hot cup of chai at a Hindu Kush hill station and ask “what is snow if not the tears of G-d, frozen as they cascade to Earth?”

The building blocks of hashish can be found on the flowers and leaves of cannabis. Glandular trichomes, the sparkly crystals that cover potent cannabis flower (and the “sugar leaves” that sprout from buds), are a form of resin that contains the cannabinoids and terpenes produced by the plant. This resin is responsible for the high of cannabis, as well as the flavors and aromas that set different cannabis chemovars apart from the crowd.

Once removed from the plant, this resin can be collected and processed into hash using a variety of methods — including ones that have been with us since antiquity.

What is the difference between hash and weed?

When people say “weed” or “pot,” “herb,” and so on, what they are referring to are the flowers of the cannabis plant. Other than drying, curing, and trimming, cannabis flower doesn’t go through any other sort of processing before it makes it to your joint. Hash on the other hand is the byproduct of removing cannabis resin and processing it into a concentrate. While both cannabis flower and hashish come from the cannabis plant, that is where the similarities end.

In addition, because it is made from pure, concentrated cannabis resin, hashish is typically much more potent than flower, and produces a high that can be more narcotic than that of many cannabis flower varieties. In addition, because of its consistency and potency, the methods of consuming hashish can differ widely from those of cannabis flower.

The different types of hash

Old school hash

From the Himalayan foothills to the back alleys of Cairo and the Rif mountains of Morocco, hash has been an international phenomenon for centuries.

When we look at (really) old school hash, they tend to take a few forms. In North Africa and the Levant, cannabis plants are harvested and dried, after which the buds are worked by hand until the dry trichomes – what is often called kief – separates from the flowers. The kief is then collected and pressed into bricks or “cakes” of hash.

Perhaps the oldest form of hash is Charas – very similar to Nepalese Temple Balls – which is traditionally made by taking fresh (not dried) cannabis buds and rolling them between your hands gradually for hours to let the resin accumulate on your palms, where it is later collected and pressed into “fingers” or balls.

Dry sift hash

Dry sift hash is basically the method used in North Africa and the Levant, and involves taking dried buds and removing the trichomes so they can be collected and processed. Dry sift hash is usually made using a fine or micron screen, and working the buds over the surface like a gold prospector, if a bit more productive.

Bubble hash

The name “bubble hash” comes from the method used to make this type of hash, which is also referred to as “water hash.” The process involves using ice, water, and filter bags to remove trichomes from cannabis flower and trim, which can then be easily dried and pressed into hash.

Related Stories

Hash how to make hash. Смотреть фото Hash how to make hash. Смотреть картинку Hash how to make hash. Картинка про Hash how to make hash. Фото Hash how to make hash

Hash how to make hash. Смотреть фото Hash how to make hash. Смотреть картинку Hash how to make hash. Картинка про Hash how to make hash. Фото Hash how to make hash

Hash how to make hash. Смотреть фото Hash how to make hash. Смотреть картинку Hash how to make hash. Картинка про Hash how to make hash. Фото Hash how to make hash

Rosin

Rosin is a very popular cannabis concentrate which is made by using heat and pressure to extract resin from the plant matter, in the form of a syrupy sap. This form of hash oil can be as potent as lab-produced, solvent-based cannabis extracts, and can be dabbed with ease – and to potent effect.

How do you smoke hashish? 3 methods

The consistency of hash – typically in the form of a piece removed from a solid chunk or sphere – means it can’t be broken up and smoked as easily as dried cannabis flower. And because of its high potency, you wouldn’t need that much anyway.

Smoking hash takes a little bit of work, but there are several easy and effective methods.

1. In a joint or cigarette

A small piece of hash can be heated with a lighter in the palm of your hand — or while resting on a piece of foil — until it becomes soft and supple and breaks down easily. Crumbled up hash can then be sprinkled in a joint or a hand-rolled cigarette and smoked with ease. If it’s especially sticky and hard to break down – like charas typically is – one option is to take a small piece and roll it between your hands until you have a long, toothpick-sized piece that you can then place inside a joint or cigarette.

2. The hot knives method

Two methods that could have you feeling like MacGyver are the hot knives method and the paperclip and glass trick. Both serve as ways to smoke a small piece of hash without mixing it with marijuana or tobacco.

Simply heat up the ends of two butter knives on your stove until they get very hot. Take a pair of tweezers or a paper clip and place a small piece of hash on one of the knives and press the other hot tip over it. Press the hash between the two knives and inhale the smoke that it produces. You can have a partner hold the knives while you place an empty plastic bottle above the knives to catch the smoke and funnel it to your mouth.

If you have a small glass and a paperclip and straw, an easy method is to bend the paper clip until one side is sticking straight up while the paperclip rests on the table. Place a small piece of hash on the end of the paperclip and light it until it burns on its own for a second. Blow out the flame and cover the paperclip and hash with a small glass. After it fills with smoke, place a straw under the bottom of the cup and lift it slightly, inhaling powerfully through the straw. Both of these methods work wonders and allow you to get a clean, potent hit of pure hash smoke.

3. Top off a bowl with hash

A very easy and straightforward method of smoking hash is to simply take a small sliver of hash and place it on top of a bowl of cannabis in your pipe or bong. It may take longer to burn than the herb it rests on, but you’ll find it an effective and memorable way of smoking.

How to make hash

Making hash on your own, with even the most rudimentary of tools is easy and straightforward. Here are three very simple methods for making your own batch.

How to make dry sift hash

To make hash with kief, simply work the dry buds or trim back and forth gently over micron screens, letting all of the kief fall to a tray below. Typically the smaller the gauge, the finer the kief you’ll harvest. The dry sift method is very versatile because once the kief has collected below, you can either press it into hash, or just put it aside and have a stash of kief that you can sprinkle on bowls or into joints whenever the urge strikes.

Instructions:

How to make bubble hash

What is bubble hash you ask? Also known as water hash, bubble hash uses ice, water, and filter bags to pull the trichomes from the cannabis so it can be formed into hash.

To make bubble hash you’ll need cannabis flower and/or trim, filter bags, two buckets, cold water, and parchment paper. A lot of recipes call for using your washing machine in concert with the filter bags, ice, and water, but we’re going to focus on how to make it by hand.

Instructions:

After the hash is dry, you can press it into blocks. The different levels of hash will be of different grades, and you can either separate them or press them together.

You can also reuse the plant material from the first round and repeat the process from the beginning to produce more bubble hash.

Make your own hash rosin

Rosin is a very popular and potent cannabis concentrate and all it requires is some cannabis flower, kief and/or cannabis trim, parchment paper, and a hair straightener.

Instructions:

Use your hands to make hash

Used to make charas, this method is done by just using the tools that you always have on hand, literally.

All you need is some freshly picked cannabis flower and your own two hands. Make sure to use flowers that aren’t fully mature and which aren’t dry.

Instructions:

Make sure to have some good, strong soap on hand, you’re going to need it to clean up afterwards.

Use cannabis trim to make hash

Cannabis trim refers to the sugar leaves and fan leaves that have trichomes on their surface and are often discarded during the trimming process. This is something of a shame, because they can actually be used to harvest kief for hash.

Making hash with weed trim is pretty easy, and quite similar to how you would make dry sift hash or rosin.

Instructions:

You can also fill a bubble bag with trim just like you would with cannabis flower and make bubble hash, though it will require a significant amount of trim.

In addition, you can take your trim and make rosin the same way you would with cannabis flower, just make sure to place it into a rosin bag first in order to filter it.

A version of this article was first published on November 1, 2020.

Хэширование: Просто и наглядно

Хэширование, или хэш-функция — одна из основных составляющих современной криптографии и протокола блокчейна.

Но, что это такое? Как наглядно представить сущность хэша?

Начнем с того, что хэширование — это особое преобразование любого массива информации, в результате которого получается некое отображение, образ или дайджест, называемый хэшем (hash) — уникальная короткая символьная строка, которая присуща только этому массиву входящей информации.

Из этого следует, что для любого объема информации, будь-то одна буква или роман Льва Толстого «Война и мир» (или даже всё Полное собрание сочинений этого атвора) существует уникальный и неповторимый хэш — короткая символьная строка. Причем, если в той же «Войне и мире» изменить хотя бы один символ, добавить один лишь знак, — хэш изменится кардинально.

Как такое может быть? Целый многотомный роман и коротокая строчка, которая отражает его!

В этом смысле хэш подобен отпечатку пальца человека.

Hash how to make hash. Смотреть фото Hash how to make hash. Смотреть картинку Hash how to make hash. Картинка про Hash how to make hash. Фото Hash how to make hash

Как известно, отпечаток пальца уникален и в природе не существует людей с одинаковыми отпечатками. Даже у близнецов отпечатки пальцев разные.

То же касается и структуры ДНК человека. Она уникальна! Нет людей с одинаковым набором ДНК.

Но, ведь, ДНК, а тем более отпечаток пальцев — относительно короткие наборы информации. И, тем не менее, они являются неким кодом, присущим конкретному человеку. Можно считать, что это и есть «хэши» этого человека. С тем лишь отличием, что эти «хэши» не меняются с возрастом человека.

Итак, первое свойство хэша — его уникальность:

Тем не менее, иногда встречаются т.н. коллизии — случаи, когда хеш-функция для разных входных блоков информации вычисляет одинаковые хэш-коды.

Математики-криптографы стараются создать такие хэш-функции, вероятность коллизий в которых стремилась бы к нолю.

Следует отметить, что функций, которые вычисляют хэш, существует множество. Но, наиболее распространена (в частности, используется в протоколе блокчейна биткоина) хэш-функция под названием SHA-256 (от Secure Hash Algorithm — безопасный алгоритм хеширования). Эта хэш-функция формирует хэш в виде строки из 64 символов (длина — 256 бит или 32 байта).

Попробуем при помощи SHA-256 hash калькулятора получить хэш для заголовка этой статьи (« Хэширование: Просто и наглядно»).

Это будет: ef3c82303f3896044125616982c715e7757d4cd1f84c34c6b2e64167d2fde766

Как видите, изменение всего лишь на один знак исходного массива информации привело к кардинальному изменению его хэша!

И это второе важное свойство хэша:

Это свойство важно при использовании хэширования в цифровой подписи, т.к. позволяет удостовериться, что подписанная информация не была изменена во время её передачи по каналам связи. Но, подробнее об этом в следующей моей статье.

Третье важное свойство хэша, вытекает из того, что хэш-функция необратима. Другими словами:

Из этого следует, что восстановить по хэшу соответствующий ему массив информации возможно только перебором всех возможных вариантов. Что практически невозможно, поскольку количество информации бесконечно!

Это свойство важно, поскольку делает взлом хэша (восстановление исходной информации по её хэшу) или невозможным или весьма дорогостоящим занятием.

Еще одно важное свойство хэш-функций — это высокая скорость работы.

Этим хэширование существенно отличается от кодирования (шифрования) и декодирования (дешифрования).

Хэширование или хэш-функция используется во многих алгоритмах и протоколах. В частности, в электронной (цифровой) подписи и блокчейне.

Просто и наглядно, как это делается, я расскажу в следующих статьях.

А пока прочитайте мою предыдущую статью из цикла «Просто и наглядно» о Шифровании с открытым ключом.

Hash how to make hash

(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL hash >= 1.1)

hash — Generate a hash value (message digest)

Description

Parameters

Message to be hashed.

An array of options for the various hashing algorithms. Currently, only the «seed» parameter is supported by the MurmurHash variants.

Return Values

Returns a string containing the calculated message digest as lowercase hexits unless binary is set to true in which case the raw binary representation of the message digest is returned.

Changelog

VersionDescription
8.1.0The options parameter has been added.
8.0.0hash() now throws a ValueError exception if algo is unknown; previously, false was returned instead.

Examples

Example #1 A hash() example

The above example will output:

See Also

User Contributed Notes 19 notes

I was interested how «long» each hash is, so I did:

md2 32 a9046c73e00331af68917d3804f70655
md4 32 866437cb7a794bce2b727acc0362ee27
md5 32 5d41402abc4b2a76b9719d911017c592
sha1 40 aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d
sha256 64 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e730
sha384 96 59e1748777448c69de6b800d7a33bbfb9ff1b463e44354c3553
sha512 128 9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caadae2d
ripemd128 32 789d569f08ed7055e94b4289a4195012
ripemd160 40 108f07b8382412612c048d07d13f814118445acd
ripemd256 64 cc1d2594aece0a064b7aed75a57283d9490fd5705ed3d66bf9a
ripemd320 80 eb0cf45114c56a8421fbcb33430fa22e0cd607560a88bbe14ce
whirlpool 128 0a25f55d7308eca6b9567a7ed3bd1b46327f0f1ffdc804dd8bb
tiger128,3 32 a78862336f7ffd2c8a3874f89b1b74f2
tiger160,3 40 a78862336f7ffd2c8a3874f89b1b74f2f27bdbca
tiger192,3 48 a78862336f7ffd2c8a3874f89b1b74f2f27bdbca39660254
tiger128,4 32 1c2a939f230ee5e828f5d0eae5947135
tiger160,4 40 1c2a939f230ee5e828f5d0eae5947135741cd0ae
tiger192,4 48 1c2a939f230ee5e828f5d0eae5947135741cd0aefeeb2adc
snefru 64 7c5f22b1a92d9470efea37ec6ed00b2357a4ce3c41aa6e28e3b
gost 64 a7eb5d08ddf2363f1ea0317a803fcef81d33863c8b2f9f6d7d1
adler32 8 062c0215
crc32 8 3d653119
crc32b 8 3610a686
haval128,3 32 85c3e4fac0ba4d85519978fdc3d1d9be
haval160,3 40 0e53b29ad41cea507a343cdd8b62106864f6b3fe
haval192,3 48 bfaf81218bbb8ee51b600f5088c4b8601558ff56e2de1c4f
haval224,3 56 92d0e3354be5d525616f217660e0f860b5d472a9cb99d6766be
haval256,3 64 26718e4fb05595cb8703a672a8ae91eea071cac5e7426173d4c
haval128,4 32 fe10754e0b31d69d4ece9c7a46e044e5
haval160,4 40 b9afd44b015f8afce44e4e02d8b908ed857afbd1
haval192,4 48 ae73833a09e84691d0214f360ee5027396f12599e3618118
haval224,4 56 e1ad67dc7a5901496b15dab92c2715de4b120af2baf661ecd92
haval256,4 64 2d39577df3a6a63168826b2a10f07a65a676f5776a0772e0a87
haval128,5 32 d20e920d5be9d9d34855accb501d1987
haval160,5 40 dac5e2024bfea142e53d1422b90c9ee2c8187cc6
haval192,5 48 bbb99b1e989ec3174019b20792fd92dd67175c2ff6ce5965
haval224,5 56 aa6551d75e33a9c5cd4141e9a068b1fc7b6d847f85c3ab16295
haval256,5 64 348298791817d5088a6de6c1b6364756d404a50bd64e645035f

I’m not posting here due to message length limitations.

The well known hash functions MD5 and SHA1 should be avoided in new applications. Collission attacks against MD5 are well documented in the cryptographics literature and have already been demonstrated in practice. Therefore, MD5 is no longer secure for certain applications.

Collission attacks against SHA1 have also been published, though they still require computing power, which is somewhat out of scope. As computing power increases with time and the attacks are likely to get better, too, attacks against systems relying on SHA1 for security are likely to become feasible within the next few years.

There is no lack of potential alternative hash algorithms, as the many choices for the «algo» argument of PHPs hash() function already suggests. Unfortunately, there is lack of analysis, as to how secure these alternative algorithms are. It is rather safe to assume, though, that the SHA2 family with its most prominent members SHA-256 und SHA-512, is better than SHA1.

When storing password hashes, it is a good idea to prefix a salt to the password before hashing, to avoid the same passwords to hash to the same values and to avoid the use of rainbow tables for password recovery. Unlike suggested in other articles, there is no security advantage in putting the salt in the middle, or even at both the beginning and the end, of the combined salt-password-string.

Rather, there are two other factors, that determine the strength of the salt: Its length and its variability. For example, using the same salt for all passwords is easy to implement, but gives only very little additional security. In particular, if users type the same passwords, they will still hash to the same value!

Therefore, the salt should be random string with at least as many variable bits, as there are bits in the hash result. In the user database, store username, the randomly generated salt for that user, and the result of hashing the salt-password-string. Access authentication is then done by looking up the entry for the user, calculating the hash of the salt found in the database and the password provided by the user, and comparing the result with the one stored in the database.

Results: (in microseconds)
1. md4 5307.912
2. md5 6890.058
3. crc32b 7298.946
4. crc32 7561.922
5. sha1 8886.098
6. tiger128,3 11054.992
7. haval192,3 11132.955
8. haval224,3 11160.135
9. tiger160,3 11162.996
10. haval160,3 11242.151
11. haval256,3 11327.981
12. tiger192,3 11630.058
13. haval128,3 11880.874
14. tiger192,4 14776.945
15. tiger128,4 14871.12
16. tiger160,4 14946.937
17. haval160,4 15661.954
18. haval192,4 15717.029
19. haval256,4 15759.944
20. adler32 15796.184
21. haval128,4 15887.022
22. haval224,4 16047.954
23. ripemd256 16245.126
24. haval160,5 17818.927
25. haval128,5 17887.115
26. haval224,5 18085.002
27. haval192,5 18135.07
28. haval256,5 18678.903
29. sha256 19020.08
30. ripemd128 20671.844
31. ripemd160 21853.923
32. ripemd320 22425.889
33. sha384 45102.119
34. sha512 45655.965
35. gost 57237.148
36. whirlpool 64682.96
37. snefru 80352.783
38. md2 705397.844

Code for generating this:
(compatible both with browser and cli mode)

Of the hash algorithms currently available, SHA3 was chosen by NIST from fifty-one submitted candidates and subsequently mandated by the U.S. Department of Commerce for Federal Government use.

So if you’re wanting to select a hash algorithm, you can consider SHA3 to be «good enough for government work».

Just a quick note about these benchmarks and how you should apply them.

If you are hashing passwords etc for security, speed is not your friend. You should use the slowest method.

Slow to hash means slow to crack and will hopefully make generating things like rainbow tables more trouble than it’s worth.

n° hash results
1. adler32 (hex) 555.992 ms
2. adler32 (raw) 556.945 ms
3. fnv132 (raw) 1107.931 ms
4. fnv1a64 (raw) 1107.931 ms
5. fnv164 (raw) 1108.169 ms
6. fnv1a32 (raw) 1108.884 ms
7. fnv164 (hex) 1108.884 ms
8. fnv1a64 (hex) 1109.123 ms
9. fnv132 (hex) 1116.991 ms
10. fnv1a32 (hex) 1147.985 ms
11. tiger192,3 (raw) 1523.017 ms
12. tiger192,3 (hex) 1532.077 ms
13. tiger128,3 (hex) 1538.038 ms
14. tiger128,3 (raw) 1546.144 ms
15. md4 (raw) 1554.965 ms
16. md4 (hex) 1565.933 ms
17. tiger160,3 (raw) 1574.039 ms
18. tiger160,3 (hex) 1588.106 ms
19. joaat (hex) 1661.777 ms
20. joaat (raw) 1662.969 ms
21. md5 (raw) 1822.948 ms
22. md5 (hex) 1842.975 ms
23. tiger160,4 (hex) 1996.994 ms
24. tiger160,4 (raw) 2007.961 ms
25. tiger128,4 (raw) 2035.14 ms
26. tiger192,4 (raw) 2043.962 ms
27. tiger128,4 (hex) 2065.896 ms
28. tiger192,4 (hex) 2070.903 ms
29. sha1 (hex) 2254.009 ms
30. sha1 (raw) 2326.011 ms
31. sha3-224 (hex) 2768.039 ms
32. sha3-224 (raw) 2783.06 ms
33. sha512 (hex) 2936.124 ms
34. sha512 (raw) 2943.992 ms
35. sha3-256 (hex) 2945.899 ms
36. sha3-256 (raw) 2970.933 ms
37. sha512/224 (raw) 2990.007 ms
38. sha384 (raw) 3006.935 ms
39. sha512/224 (hex) 3010.988 ms
40. sha512/256 (raw) 3024.101 ms
41. sha384 (hex) 3036.975 ms
42. ripemd256 (raw) 3068.923 ms
43. ripemd256 (hex) 3072.023 ms
44. ripemd128 (raw) 3077.03 ms
45. ripemd128 (hex) 3123.998 ms
46. sha512/256 (hex) 3184.08 ms
47. haval256,3 (hex) 3671.884 ms
48. haval224,3 (hex) 3776.073 ms
49. sha3-384 (hex) 3777.98 ms
50. haval128,3 (raw) 3823.041 ms
51. haval128,3 (hex) 3829.002 ms
52. sha3-384 (raw) 3835.916 ms
53. haval256,3 (raw) 3852.128 ms
54. haval224,3 (raw) 3855.943 ms
55. haval160,3 (raw) 3859.996 ms
56. haval160,3 (hex) 3862.857 ms
57. haval192,3 (raw) 3892.898 ms
58. haval192,3 (hex) 3922.939 ms
59. crc32c (hex) 4080.057 ms
60. ripemd160 (hex) 4091.024 ms
61. ripemd160 (raw) 4094.123 ms
62. ripemd320 (raw) 4114.866 ms
63. crc32b (hex) 4116.058 ms
64. crc32 (raw) 4118.919 ms
65. ripemd320 (hex) 4175.186 ms
66. crc32c (raw) 4180.908 ms
67. crc32 (hex) 4194.974 ms
68. crc32b (raw) 4208.803 ms
69. sha224 (hex) 4735.946 ms
70. sha256 (raw) 4753.112 ms
71. sha256 (hex) 4761.934 ms
72. sha224 (raw) 4762.887 ms
73. haval192,4 (raw) 5304.098 ms
74. haval160,4 (raw) 5308.151 ms
75. haval128,4 (raw) 5323.886 ms
76. haval192,4 (hex) 5346.059 ms
77. haval128,4 (hex) 5351.066 ms
78. haval256,4 (hex) 5367.04 ms
79. haval256,4 (raw) 5378.007 ms
80. haval224,4 (raw) 5398.988 ms
81. haval224,4 (hex) 5413.055 ms
82. sha3-512 (raw) 5460.023 ms
83. sha3-512 (hex) 5527.973 ms
84. haval160,4 (hex) 5529.88 ms
85. haval192,5 (hex) 6403.923 ms
86. haval160,5 (raw) 6499.052 ms
87. haval128,5 (raw) 6513.833 ms
88. haval160,5 (hex) 6540.06 ms
89. haval128,5 (hex) 6541.013 ms
90. haval192,5 (raw) 6566.047 ms
91. haval224,5 (raw) 6567.001 ms
92. haval256,5 (hex) 6577.014 ms
93. haval224,5 (hex) 6598.949 ms
94. haval256,5 (raw) 6598.949 ms
95. whirlpool (raw) 9627.103 ms
96. whirlpool (hex) 9634.017 ms
97. gost (raw) 18457.889 ms
98. gost-crypto (raw) 18479.824 ms
99. gost (hex) 18527.03 ms
100. gost-crypto (hex) 18530.13 ms
101. snefru256 (hex) 36260.843 ms
102. snefru256 (raw) 36325.931 ms
103. snefru (hex) 36480.903 ms
104. snefru (raw) 36496.877 ms
105. md2 (raw) 184617.996 ms
106. md2 (hex) 185398.101 ms

I made a PHP script that will let you sort all the available hashes on your system by generation time or by the length of the hash. It shows a general correlation on my system (longer hashes take longer to calculate) but some are faster than others, for example, sha512 makes the (joint) longest hash, but is actually only ninth slowest (from 43 hashes available on my machine)

As I understand it, the strength of a hash is dependant on the number of collisions that it has (where two input values produce the same hash) so with an infinite number of input values but a finite number of hashes, there are a (theoretically) infinite number of collisions. But, if you have a longer hash, then you’re dividing infinity by a larger number, so you’ll have fewer collisions.

In reality the number of collisions will be limited by the minimum and maximum password lengths that you choose to allow, so that if you enforce a policy where passwords must be exactly a certain length (20 characters for example) you’ll have a large number of unique passwords, but a smaller number of potential inputs than you have hashes coming out, so that should prevent collisions entirely. In theory.

Tl;dr: I think that longer hashes are better.

Anyway, here’s the code:
= «hello» ;

Источники информации:

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *