highwayhash 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/highwayhash.rb +34 -0
- data/lib/highwayhash/version.rb +3 -0
- metadata +72 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 58a3506a64e6350637fea96d0ee5573fc4da6ebd32d42cb8ab7fe6734b49f8fb
|
4
|
+
data.tar.gz: d4ea55e50512047867d5067d41e63d80d605c3a439595f0bcc9026b6cdd5b921
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 553832e151b206e0cc9de8da1726774977b41787f48c3d8d43aaf4caf504296665e848088c58148f968526886bdade96c6d71c365311bb0287f1a412c02bea2a
|
7
|
+
data.tar.gz: 7b75e6ccbcae0b2dd37fbe30a1d624663405d54be6c15e7702b92a9f4a6e1771ecdddc3a9267679c4e89d1862fce07179fa70b0aa613e96aad0dbabba15a628d
|
data/lib/highwayhash.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'ffi'
|
3
|
+
|
4
|
+
module Highwayhash
|
5
|
+
extend FFI::Library
|
6
|
+
ffi_lib 'libhighwayhash'
|
7
|
+
|
8
|
+
attach_function :__highway_hash64,
|
9
|
+
:HighwayHash64, [
|
10
|
+
:pointer, # secret key (4 uint64 numbers)
|
11
|
+
:pointer, # data to be hashed
|
12
|
+
:ulong_long # length of data
|
13
|
+
], :ulong_long
|
14
|
+
|
15
|
+
private def hash64(input, key)
|
16
|
+
raise ArgumentError.new("Key length must be 32 bytes") if key.size != 32
|
17
|
+
|
18
|
+
if input.respond_to?(:read)
|
19
|
+
data = input.read
|
20
|
+
else
|
21
|
+
data = input
|
22
|
+
end
|
23
|
+
|
24
|
+
input_size = data.bytesize
|
25
|
+
|
26
|
+
input_p = FFI::MemoryPointer.from_string(data)
|
27
|
+
|
28
|
+
key_p = FFI::MemoryPointer.new(:ulong_long, 4)
|
29
|
+
key_p.write_array_of_uint64(key.unpack("Q4"))
|
30
|
+
|
31
|
+
__highway_hash64(key_p, input_p, input_size)
|
32
|
+
end
|
33
|
+
module_function :hash64
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: highwayhash
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Cook
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-05-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: ffi
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.9'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: minitest
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '5'
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- lib/highwayhash.rb
|
48
|
+
- lib/highwayhash/version.rb
|
49
|
+
homepage: https://github.com/jamescook/highwayhash
|
50
|
+
licenses:
|
51
|
+
- MIT
|
52
|
+
metadata: {}
|
53
|
+
post_install_message:
|
54
|
+
rdoc_options: []
|
55
|
+
require_paths:
|
56
|
+
- lib
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.1'
|
62
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
requirements: []
|
68
|
+
rubygems_version: 3.0.3
|
69
|
+
signing_key:
|
70
|
+
specification_version: 4
|
71
|
+
summary: Highwayhash Ruby C Extension
|
72
|
+
test_files: []
|