digest-blake2b 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/Gemfile +4 -0
- data/Rakefile +3 -1
- data/digest-blake2b.gemspec +6 -6
- data/ext/digest/{blake2b_ext → blake2b/ext}/blake2-config.h +6 -6
- data/ext/digest/{blake2b_ext → blake2b/ext}/blake2-impl.h +8 -7
- data/ext/digest/{blake2b_ext → blake2b/ext}/blake2.h +4 -3
- data/ext/digest/{blake2b_ext → blake2b/ext}/blake2b-load-sse2.h +0 -0
- data/ext/digest/{blake2b_ext → blake2b/ext}/blake2b-load-sse41.h +0 -0
- data/ext/digest/{blake2b_ext → blake2b/ext}/blake2b-ref.c +7 -7
- data/ext/digest/{blake2b_ext → blake2b/ext}/blake2b-round.h +3 -2
- data/ext/digest/{blake2b_ext → blake2b/ext}/extconf.rb +1 -1
- data/ext/digest/{blake2b_ext → blake2b/ext}/rbext.c +1 -1
- data/lib/digest/blake2b/version.rb +1 -1
- data/lib/digest/blake2b.rb +1 -1
- metadata +29 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f6ddf84f1a45241173888cd08e58d83d14d68b6aa5aebaa75fc26166ddfe872
|
4
|
+
data.tar.gz: 1c85b12e4305d8443f5ef6c74ffd8ea5694f394649ecedecfe76e853d3326fcb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d95f7026949e3c5240239a32233a47ef05eb0e6336acdb6a1f3d57344892dab697c49747ae3f11aa119afb619e693eadf63abb7121fdac8b6f265a82da44b80a
|
7
|
+
data.tar.gz: 1e3310cf5816eabf5d03d960e194a1208e5b7cc4a9a2d2fc8898e4b2772dd959c31623292c79cfd4cdc67d0acfd9db7b1d55d93df9cc943f56145722d2536262
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'bundler/gem_tasks'
|
2
4
|
require 'rake/testtask'
|
3
5
|
require 'rake/extensiontask'
|
4
6
|
|
5
7
|
spec = Gem::Specification.load('digest-blake2b.gemspec')
|
6
8
|
|
7
|
-
Rake::ExtensionTask.new('digest/
|
9
|
+
Rake::ExtensionTask.new('digest/blake2b/ext', spec) do |ext|
|
8
10
|
ext.source_pattern = '*.{c,h}'
|
9
11
|
end
|
10
12
|
|
data/digest-blake2b.gemspec
CHANGED
@@ -13,9 +13,9 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.summary = 'The BLAKE2b cryptographic hash function.'
|
14
14
|
spec.platform = Gem::Platform::RUBY
|
15
15
|
|
16
|
-
spec.required_ruby_version = '
|
16
|
+
spec.required_ruby_version = '>= 2.1', '< 4'
|
17
17
|
|
18
|
-
spec.authors = ['Franck Verrot', 'Mauricio Gomes']
|
18
|
+
spec.authors = ['Alex Kotov', 'Franck Verrot', 'Mauricio Gomes']
|
19
19
|
spec.email = %w[mauricio@edge14.com]
|
20
20
|
|
21
21
|
spec.description = <<-DESCRIPTION.split.join ' '
|
@@ -41,10 +41,10 @@ Gem::Specification.new do |spec|
|
|
41
41
|
|
42
42
|
spec.executables = spec.files.grep %r{^exe/}, &File.method(:basename)
|
43
43
|
|
44
|
-
spec.extensions << 'ext/digest/
|
44
|
+
spec.extensions << 'ext/digest/blake2b/ext/extconf.rb'
|
45
45
|
|
46
|
-
spec.add_development_dependency '
|
47
|
-
spec.add_development_dependency 'bundler' , '~> 1.5'
|
48
|
-
spec.add_development_dependency 'rake' , '~> 11.1'
|
46
|
+
spec.add_development_dependency 'bundler' , '~> 2.2'
|
49
47
|
spec.add_development_dependency 'minitest' , '~> 5.11'
|
48
|
+
spec.add_development_dependency 'rake' , '~> 13.0'
|
49
|
+
spec.add_development_dependency 'rake-compiler', '~> 0.9'
|
50
50
|
end
|
@@ -12,6 +12,7 @@
|
|
12
12
|
More information about the BLAKE2 hash function can be found at
|
13
13
|
https://blake2.net.
|
14
14
|
*/
|
15
|
+
|
15
16
|
#ifndef BLAKE2_CONFIG_H
|
16
17
|
#define BLAKE2_CONFIG_H
|
17
18
|
|
@@ -20,23 +21,22 @@
|
|
20
21
|
#define HAVE_SSE2
|
21
22
|
#endif
|
22
23
|
|
23
|
-
#
|
24
|
+
#ifdef __SSSE3__
|
24
25
|
#define HAVE_SSSE3
|
25
26
|
#endif
|
26
27
|
|
27
|
-
#
|
28
|
+
#ifdef __SSE4_1__
|
28
29
|
#define HAVE_SSE41
|
29
30
|
#endif
|
30
31
|
|
31
|
-
#
|
32
|
+
#ifdef __AVX__
|
32
33
|
#define HAVE_AVX
|
33
34
|
#endif
|
34
35
|
|
35
|
-
#
|
36
|
+
#ifdef __XOP__
|
36
37
|
#define HAVE_XOP
|
37
38
|
#endif
|
38
39
|
|
39
|
-
|
40
40
|
#ifdef HAVE_AVX2
|
41
41
|
#ifndef HAVE_AVX
|
42
42
|
#define HAVE_AVX
|
@@ -65,7 +65,7 @@
|
|
65
65
|
#define HAVE_SSE2
|
66
66
|
#endif
|
67
67
|
|
68
|
-
#
|
68
|
+
#ifndef HAVE_SSE2
|
69
69
|
#error "This code requires at least SSE2."
|
70
70
|
#endif
|
71
71
|
|
@@ -12,6 +12,7 @@
|
|
12
12
|
More information about the BLAKE2 hash function can be found at
|
13
13
|
https://blake2.net.
|
14
14
|
*/
|
15
|
+
|
15
16
|
#ifndef BLAKE2_IMPL_H
|
16
17
|
#define BLAKE2_IMPL_H
|
17
18
|
|
@@ -19,7 +20,7 @@
|
|
19
20
|
#include <string.h>
|
20
21
|
|
21
22
|
#if !defined(__cplusplus) && (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L)
|
22
|
-
#
|
23
|
+
#ifdef _MSC_VER
|
23
24
|
#define BLAKE2_INLINE __inline
|
24
25
|
#elif defined(__GNUC__)
|
25
26
|
#define BLAKE2_INLINE __inline__
|
@@ -32,7 +33,7 @@
|
|
32
33
|
|
33
34
|
static BLAKE2_INLINE uint32_t load32( const void *src )
|
34
35
|
{
|
35
|
-
#
|
36
|
+
#ifdef NATIVE_LITTLE_ENDIAN
|
36
37
|
uint32_t w;
|
37
38
|
memcpy(&w, src, sizeof w);
|
38
39
|
return w;
|
@@ -47,7 +48,7 @@ static BLAKE2_INLINE uint32_t load32( const void *src )
|
|
47
48
|
|
48
49
|
static BLAKE2_INLINE uint64_t load64( const void *src )
|
49
50
|
{
|
50
|
-
#
|
51
|
+
#ifdef NATIVE_LITTLE_ENDIAN
|
51
52
|
uint64_t w;
|
52
53
|
memcpy(&w, src, sizeof w);
|
53
54
|
return w;
|
@@ -66,7 +67,7 @@ static BLAKE2_INLINE uint64_t load64( const void *src )
|
|
66
67
|
|
67
68
|
static BLAKE2_INLINE uint16_t load16( const void *src )
|
68
69
|
{
|
69
|
-
#
|
70
|
+
#ifdef NATIVE_LITTLE_ENDIAN
|
70
71
|
uint16_t w;
|
71
72
|
memcpy(&w, src, sizeof w);
|
72
73
|
return w;
|
@@ -79,7 +80,7 @@ static BLAKE2_INLINE uint16_t load16( const void *src )
|
|
79
80
|
|
80
81
|
static BLAKE2_INLINE void store16( void *dst, uint16_t w )
|
81
82
|
{
|
82
|
-
#
|
83
|
+
#ifdef NATIVE_LITTLE_ENDIAN
|
83
84
|
memcpy(dst, &w, sizeof w);
|
84
85
|
#else
|
85
86
|
uint8_t *p = ( uint8_t * )dst;
|
@@ -90,7 +91,7 @@ static BLAKE2_INLINE void store16( void *dst, uint16_t w )
|
|
90
91
|
|
91
92
|
static BLAKE2_INLINE void store32( void *dst, uint32_t w )
|
92
93
|
{
|
93
|
-
#
|
94
|
+
#ifdef NATIVE_LITTLE_ENDIAN
|
94
95
|
memcpy(dst, &w, sizeof w);
|
95
96
|
#else
|
96
97
|
uint8_t *p = ( uint8_t * )dst;
|
@@ -103,7 +104,7 @@ static BLAKE2_INLINE void store32( void *dst, uint32_t w )
|
|
103
104
|
|
104
105
|
static BLAKE2_INLINE void store64( void *dst, uint64_t w )
|
105
106
|
{
|
106
|
-
#
|
107
|
+
#ifdef NATIVE_LITTLE_ENDIAN
|
107
108
|
memcpy(dst, &w, sizeof w);
|
108
109
|
#else
|
109
110
|
uint8_t *p = ( uint8_t * )dst;
|
@@ -12,19 +12,20 @@
|
|
12
12
|
More information about the BLAKE2 hash function can be found at
|
13
13
|
https://blake2.net.
|
14
14
|
*/
|
15
|
+
|
15
16
|
#ifndef BLAKE2_H
|
16
17
|
#define BLAKE2_H
|
17
18
|
|
18
19
|
#include <stddef.h>
|
19
20
|
#include <stdint.h>
|
20
21
|
|
21
|
-
#
|
22
|
+
#ifdef _MSC_VER
|
22
23
|
#define BLAKE2_PACKED(x) __pragma(pack(push, 1)) x __pragma(pack(pop))
|
23
24
|
#else
|
24
25
|
#define BLAKE2_PACKED(x) x __attribute__((packed))
|
25
26
|
#endif
|
26
27
|
|
27
|
-
#
|
28
|
+
#ifdef __cplusplus
|
28
29
|
extern "C" {
|
29
30
|
#endif
|
30
31
|
|
@@ -188,7 +189,7 @@ extern "C" {
|
|
188
189
|
/* This is simply an alias for blake2b */
|
189
190
|
int blake2( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen );
|
190
191
|
|
191
|
-
#
|
192
|
+
#ifdef __cplusplus
|
192
193
|
}
|
193
194
|
#endif
|
194
195
|
|
File without changes
|
File without changes
|
@@ -26,16 +26,16 @@
|
|
26
26
|
#include <intrin.h> /* for _mm_set_epi64x */
|
27
27
|
#endif
|
28
28
|
#include <emmintrin.h>
|
29
|
-
#
|
29
|
+
#ifdef HAVE_SSSE3
|
30
30
|
#include <tmmintrin.h>
|
31
31
|
#endif
|
32
|
-
#
|
32
|
+
#ifdef HAVE_SSE41
|
33
33
|
#include <smmintrin.h>
|
34
34
|
#endif
|
35
|
-
#
|
35
|
+
#ifdef HAVE_AVX
|
36
36
|
#include <immintrin.h>
|
37
37
|
#endif
|
38
|
-
#
|
38
|
+
#ifdef HAVE_XOP
|
39
39
|
#include <x86intrin.h>
|
40
40
|
#endif
|
41
41
|
|
@@ -160,7 +160,7 @@ static void blake2b_compress( blake2b_state *S, const uint8_t block[BLAKE2B_BLOC
|
|
160
160
|
const __m128i r16 = _mm_setr_epi8( 2, 3, 4, 5, 6, 7, 0, 1, 10, 11, 12, 13, 14, 15, 8, 9 );
|
161
161
|
const __m128i r24 = _mm_setr_epi8( 3, 4, 5, 6, 7, 0, 1, 2, 11, 12, 13, 14, 15, 8, 9, 10 );
|
162
162
|
#endif
|
163
|
-
#
|
163
|
+
#ifdef HAVE_SSE41
|
164
164
|
const __m128i m0 = LOADU( block + 00 );
|
165
165
|
const __m128i m1 = LOADU( block + 16 );
|
166
166
|
const __m128i m2 = LOADU( block + 32 );
|
@@ -297,14 +297,14 @@ int blake2( void *out, size_t outlen, const void *in, size_t inlen, const void *
|
|
297
297
|
return blake2b(out, outlen, in, inlen, key, keylen);
|
298
298
|
}
|
299
299
|
|
300
|
-
#
|
300
|
+
#ifdef SUPERCOP
|
301
301
|
int crypto_hash( unsigned char *out, unsigned char *in, unsigned long long inlen )
|
302
302
|
{
|
303
303
|
return blake2b( out, BLAKE2B_OUTBYTES, in, inlen, NULL, 0 );
|
304
304
|
}
|
305
305
|
#endif
|
306
306
|
|
307
|
-
#
|
307
|
+
#ifdef BLAKE2B_SELFTEST
|
308
308
|
#include <string.h>
|
309
309
|
#include "blake2-kat.h"
|
310
310
|
int main( void )
|
@@ -12,6 +12,7 @@
|
|
12
12
|
More information about the BLAKE2 hash function can be found at
|
13
13
|
https://blake2.net.
|
14
14
|
*/
|
15
|
+
|
15
16
|
#ifndef BLAKE2B_ROUND_H
|
16
17
|
#define BLAKE2B_ROUND_H
|
17
18
|
|
@@ -80,7 +81,7 @@
|
|
80
81
|
row2l = _mm_roti_epi64(row2l, -63); \
|
81
82
|
row2h = _mm_roti_epi64(row2h, -63); \
|
82
83
|
|
83
|
-
#
|
84
|
+
#ifdef HAVE_SSSE3
|
84
85
|
#define DIAGONALIZE(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h) \
|
85
86
|
t0 = _mm_alignr_epi8(row2h, row2l, 8); \
|
86
87
|
t1 = _mm_alignr_epi8(row2l, row2h, 8); \
|
@@ -136,7 +137,7 @@
|
|
136
137
|
|
137
138
|
#endif
|
138
139
|
|
139
|
-
#
|
140
|
+
#ifdef HAVE_SSE41
|
140
141
|
#include "blake2b-load-sse41.h"
|
141
142
|
#else
|
142
143
|
#include "blake2b-load-sse2.h"
|
@@ -100,7 +100,7 @@ VALUE m_blake2_digest(VALUE self, VALUE _input, VALUE _representation) {
|
|
100
100
|
return result;
|
101
101
|
}
|
102
102
|
|
103
|
-
void
|
103
|
+
void Init_ext() {
|
104
104
|
mDigest = rb_define_module("Digest");
|
105
105
|
|
106
106
|
mDigest_cBlake2 = rb_define_class_under(mDigest, "Blake2b", rb_cObject);
|
data/lib/digest/blake2b.rb
CHANGED
metadata
CHANGED
@@ -1,79 +1,80 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: digest-blake2b
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
+
- Alex Kotov
|
7
8
|
- Franck Verrot
|
8
9
|
- Mauricio Gomes
|
9
10
|
autorequire:
|
10
11
|
bindir: exe
|
11
12
|
cert_chain: []
|
12
|
-
date:
|
13
|
+
date: 2021-09-16 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
16
|
+
name: bundler
|
16
17
|
requirement: !ruby/object:Gem::Requirement
|
17
18
|
requirements:
|
18
19
|
- - "~>"
|
19
20
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
21
|
+
version: '2.2'
|
21
22
|
type: :development
|
22
23
|
prerelease: false
|
23
24
|
version_requirements: !ruby/object:Gem::Requirement
|
24
25
|
requirements:
|
25
26
|
- - "~>"
|
26
27
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
28
|
+
version: '2.2'
|
28
29
|
- !ruby/object:Gem::Dependency
|
29
|
-
name:
|
30
|
+
name: minitest
|
30
31
|
requirement: !ruby/object:Gem::Requirement
|
31
32
|
requirements:
|
32
33
|
- - "~>"
|
33
34
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
35
|
+
version: '5.11'
|
35
36
|
type: :development
|
36
37
|
prerelease: false
|
37
38
|
version_requirements: !ruby/object:Gem::Requirement
|
38
39
|
requirements:
|
39
40
|
- - "~>"
|
40
41
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
42
|
+
version: '5.11'
|
42
43
|
- !ruby/object:Gem::Dependency
|
43
44
|
name: rake
|
44
45
|
requirement: !ruby/object:Gem::Requirement
|
45
46
|
requirements:
|
46
47
|
- - "~>"
|
47
48
|
- !ruby/object:Gem::Version
|
48
|
-
version: '
|
49
|
+
version: '13.0'
|
49
50
|
type: :development
|
50
51
|
prerelease: false
|
51
52
|
version_requirements: !ruby/object:Gem::Requirement
|
52
53
|
requirements:
|
53
54
|
- - "~>"
|
54
55
|
- !ruby/object:Gem::Version
|
55
|
-
version: '
|
56
|
+
version: '13.0'
|
56
57
|
- !ruby/object:Gem::Dependency
|
57
|
-
name:
|
58
|
+
name: rake-compiler
|
58
59
|
requirement: !ruby/object:Gem::Requirement
|
59
60
|
requirements:
|
60
61
|
- - "~>"
|
61
62
|
- !ruby/object:Gem::Version
|
62
|
-
version: '
|
63
|
+
version: '0.9'
|
63
64
|
type: :development
|
64
65
|
prerelease: false
|
65
66
|
version_requirements: !ruby/object:Gem::Requirement
|
66
67
|
requirements:
|
67
68
|
- - "~>"
|
68
69
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
70
|
+
version: '0.9'
|
70
71
|
description: BLAKE2b is a cryptographic hash function faster than MD5, SHA-1, SHA-2,
|
71
72
|
and SHA-3 for 64-bit systems.
|
72
73
|
email:
|
73
74
|
- mauricio@edge14.com
|
74
75
|
executables: []
|
75
76
|
extensions:
|
76
|
-
- ext/digest/
|
77
|
+
- ext/digest/blake2b/ext/extconf.rb
|
77
78
|
extra_rdoc_files: []
|
78
79
|
files:
|
79
80
|
- ".circleci/config.yml"
|
@@ -84,15 +85,15 @@ files:
|
|
84
85
|
- Rakefile
|
85
86
|
- checksums/.keep
|
86
87
|
- digest-blake2b.gemspec
|
87
|
-
- ext/digest/
|
88
|
-
- ext/digest/
|
89
|
-
- ext/digest/
|
90
|
-
- ext/digest/
|
91
|
-
- ext/digest/
|
92
|
-
- ext/digest/
|
93
|
-
- ext/digest/
|
94
|
-
- ext/digest/
|
95
|
-
- ext/digest/
|
88
|
+
- ext/digest/blake2b/ext/blake2-config.h
|
89
|
+
- ext/digest/blake2b/ext/blake2-impl.h
|
90
|
+
- ext/digest/blake2b/ext/blake2.h
|
91
|
+
- ext/digest/blake2b/ext/blake2b-load-sse2.h
|
92
|
+
- ext/digest/blake2b/ext/blake2b-load-sse41.h
|
93
|
+
- ext/digest/blake2b/ext/blake2b-ref.c
|
94
|
+
- ext/digest/blake2b/ext/blake2b-round.h
|
95
|
+
- ext/digest/blake2b/ext/extconf.rb
|
96
|
+
- ext/digest/blake2b/ext/rbext.c
|
96
97
|
- lib/digest/blake2b.rb
|
97
98
|
- lib/digest/blake2b/key.rb
|
98
99
|
- lib/digest/blake2b/version.rb
|
@@ -110,16 +111,19 @@ require_paths:
|
|
110
111
|
- lib
|
111
112
|
required_ruby_version: !ruby/object:Gem::Requirement
|
112
113
|
requirements:
|
113
|
-
- - "
|
114
|
+
- - ">="
|
114
115
|
- !ruby/object:Gem::Version
|
115
116
|
version: '2.1'
|
117
|
+
- - "<"
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '4'
|
116
120
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
121
|
requirements:
|
118
122
|
- - ">="
|
119
123
|
- !ruby/object:Gem::Version
|
120
124
|
version: '0'
|
121
125
|
requirements: []
|
122
|
-
rubygems_version: 3.
|
126
|
+
rubygems_version: 3.2.22
|
123
127
|
signing_key:
|
124
128
|
specification_version: 4
|
125
129
|
summary: The BLAKE2b cryptographic hash function.
|