Discohash – Fast Hash

栏目: IT技术 · 发布时间: 4年前

内容简介:Discohash(

:dancers: Discohash

2-5GB/s, passed SMHasher

Discohash( also known as BEBB4185 ) is a super simple and super fast hash that passes all of SMHasher, and runs at 2-5GB/s (depending on hardware) in this naive, portable, serial implementation.

Link to the SUPERCOP ECRYPT benchmark for bebb4185

CLI app included

Quick Facts

  • A super-fast 64-bit hash.
  • one of the fastest hashes ever benchmarked at ecrypt
  • ECRYPT benchmark is 4x faster than BLAKE3
  • Mix is super simple.
  • Tested at ~ 5GB/s @ 3Gz, (Google Cloud Platform, N1 CPU)
  • Passes all SMHasher tests.
  • Also known as : BEBB4185
  • Implemented in C++, and also a port to JS
  • This repo includes a simple CLI app for hashing files or stdin from the command line.

Simplicity

The main 128-bit-to-128-bit mixing function is just this:

mix(const int A)
    {
      const int B = A+1;
      
      ds[A] *= P;
      ds[A] = rot(ds[A], 23);
      ds[A] *= Q;
      
      ds[B] ^= ds[A];

      ds[B] *= P;
      ds[B] = rot(ds[B], 23);
      ds[B] *= Q;
    }

which is just multiplications by two 64-bit primes, P and Q, bit rotation, and xor.

P, and Q are:

  • P = 0xFFFFFFFFFFFFFFFF - 58
  • Q = 13166748625691186689

The internal state is 256-bits and the mixing function windows across that.

The standard digest is 64-bits, but you can modify it to take 128-bits if you want a cryptographically secure hash.

Using

Use the C code from this repository, either in your project or as a CL-app (included):

cd src
./build.sh
./bin/bebbsum < 0xa2a647993898a3df.txt
> 0xa2a647993898a3df
./bin/bebbsum 0xa2a647993898a3df.txt
> 0xa2a647993898a3df

or, for a JS implementation:

npm i --save bebb4185

Use in Node.JS:

import {discohash} from 'bebb4185'

Or using Snowpack as a webmodule:

import {discohash} from './web_modules/bebb4185.js';

Then call it:

const hash = discohash(string_or_typed_array_key, optional_seed);

JS Implementation

uint64_t

SMHasher verification value

The value is: BEBB4185

Possible future work

Make a parallel version using Merkle tree


以上所述就是小编给大家介绍的《Discohash – Fast Hash》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

OpenCV3编程入门

OpenCV3编程入门

毛星云 / 电子工业出版社 / 2015-2 / 79

OpenCV在计算机视觉领域扮演着重要的角色。作为一个基于开源发行的跨平台计算机视觉库,OpenCV实现了图像处理和计算机视觉方面的很多通用算法。本书以当前最新版本的OpenCV最常用最核心的组件模块为索引,深入浅出地介绍了OpenCV2和OpenCV3中的强大功能、性能,以及新特性。书本配套的OpenCV2和OpenCV3双版本的示例代码包中,含有总计两百多个详细注释的程序源代码与思路说明。读者......一起来看看 《OpenCV3编程入门》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具