sleeping_kangaroo12 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +4 -0
- data/README.md +7 -1
- data/ext/k12/lib/KangarooTwelve.c +6 -5
- data/ext/k12/lib/Optimized64/KeccakP-1600-timesN-AVX2.c +2 -2
- data/ext/k12/support/Build/ToTargetMakefile.xsl +16 -10
- data/lib/sleeping_kangaroo12/binding.rb +0 -1
- data/lib/sleeping_kangaroo12/build/loader.rb +0 -1
- data/lib/sleeping_kangaroo12/build/platform.rb +0 -2
- data/lib/sleeping_kangaroo12/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43f29b860cf5a2c6dc1fac237ebbc490a309277f7e61fcaa078a2f0c097b6a26
|
4
|
+
data.tar.gz: 96f53173416460a9a64decd3312a5c613bf3875a68bec5bb43d8cfdb834c4517
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c49649a2576b01241565d83c77e7738eec932239cda39a59cadefffaf3820d996487db856d4c7bc63c00f1b698b832bc871c8627483754bf8ee9a216df113df
|
7
|
+
data.tar.gz: 67cd342201f52cd5c94a4a35d2df005b942d3e1ca2ec5a0eb9b56e36644b996842ce4788635507460cf3f9e3dd92761d6e269224862875f9caf4d23220ce9ed7
|
data/.yardopts
ADDED
data/README.md
CHANGED
@@ -45,6 +45,12 @@ In order to install the gem, your machine should be ready to build the K12 packa
|
|
45
45
|
- xsltproc executable, normally comes with libxslt package
|
46
46
|
- Ruby related stuffs
|
47
47
|
|
48
|
+
### TL;DR for Ubuntu-liked OS
|
49
|
+
|
50
|
+
~~~bash
|
51
|
+
sudo apt install build-essential xsltproc
|
52
|
+
~~~
|
53
|
+
|
48
54
|
## Installation
|
49
55
|
|
50
56
|
Add this line to your application's Gemfile:
|
@@ -53,7 +59,7 @@ Add this line to your application's Gemfile:
|
|
53
59
|
gem 'sleeping_kangaroo12'
|
54
60
|
~~~
|
55
61
|
|
56
|
-
|
62
|
+
Check the [prerequisites](#prerequisites); and then execute:
|
57
63
|
|
58
64
|
$ bundle install
|
59
65
|
|
@@ -47,7 +47,7 @@ static void KangarooTwelve_F_Absorb(KangarooTwelve_F *instance, const unsigned c
|
|
47
47
|
i = 0;
|
48
48
|
curData = data;
|
49
49
|
while(i < dataByteLen) {
|
50
|
-
if ((instance->byteIOIndex == 0) && (dataByteLen >=
|
50
|
+
if ((instance->byteIOIndex == 0) && (dataByteLen-i >= rateInBytes)) {
|
51
51
|
#ifdef KeccakP1600_12rounds_FastLoop_supported
|
52
52
|
/* processing full blocks first */
|
53
53
|
j = KeccakP1600_12rounds_FastLoop_Absorb(instance->state, K12_rateInLanes, curData, dataByteLen - i);
|
@@ -62,7 +62,7 @@ static void KangarooTwelve_F_Absorb(KangarooTwelve_F *instance, const unsigned c
|
|
62
62
|
i = dataByteLen - j;
|
63
63
|
} else {
|
64
64
|
/* normal lane: using the message queue */
|
65
|
-
if (
|
65
|
+
if (dataByteLen - i > (size_t)rateInBytes - instance->byteIOIndex) {
|
66
66
|
partialBlock = rateInBytes-instance->byteIOIndex;
|
67
67
|
} else {
|
68
68
|
partialBlock = (uint8_t)(dataByteLen - i);
|
@@ -112,7 +112,7 @@ static void KangarooTwelve_F_Squeeze(KangarooTwelve_F *instance, unsigned char *
|
|
112
112
|
i = 0;
|
113
113
|
curData = data;
|
114
114
|
while(i < dataByteLen) {
|
115
|
-
if ((instance->byteIOIndex == rateInBytes) && (dataByteLen >=
|
115
|
+
if ((instance->byteIOIndex == rateInBytes) && (dataByteLen-i >= rateInBytes)) {
|
116
116
|
for(j=dataByteLen-i; j>=rateInBytes; j-=rateInBytes) {
|
117
117
|
KeccakP1600_Permute_12rounds(instance->state);
|
118
118
|
KeccakP1600_ExtractBytes(instance->state, curData, 0, rateInBytes);
|
@@ -125,9 +125,10 @@ static void KangarooTwelve_F_Squeeze(KangarooTwelve_F *instance, unsigned char *
|
|
125
125
|
KeccakP1600_Permute_12rounds(instance->state);
|
126
126
|
instance->byteIOIndex = 0;
|
127
127
|
}
|
128
|
-
|
129
|
-
if (partialBlock+instance->byteIOIndex > rateInBytes)
|
128
|
+
if (dataByteLen-i > rateInBytes-instance->byteIOIndex)
|
130
129
|
partialBlock = rateInBytes-instance->byteIOIndex;
|
130
|
+
else
|
131
|
+
partialBlock = (unsigned int)(dataByteLen - i);
|
131
132
|
i += partialBlock;
|
132
133
|
|
133
134
|
KeccakP1600_ExtractBytes(instance->state, curData, instance->byteIOIndex, partialBlock);
|
@@ -33,8 +33,8 @@ Please refer to the XKCP for more details.
|
|
33
33
|
#define ROL64in256(d, a, o) d = _mm256_or_si256(_mm256_slli_epi64(a, o), _mm256_srli_epi64(a, 64-(o)))
|
34
34
|
#define ROL64in256_8(d, a) d = _mm256_shuffle_epi8(a, CONST256(rho8))
|
35
35
|
#define ROL64in256_56(d, a) d = _mm256_shuffle_epi8(a, CONST256(rho56))
|
36
|
-
static const uint64_t rho8[4]
|
37
|
-
static const uint64_t rho56[4]
|
36
|
+
static ALIGN(AVX2alignment) const uint64_t rho8[4] = {0x0605040302010007, 0x0E0D0C0B0A09080F, 0x1615141312111017, 0x1E1D1C1B1A19181F};
|
37
|
+
static ALIGN(AVX2alignment) const uint64_t rho56[4] = {0x0007060504030201, 0x080F0E0D0C0B0A09, 0x1017161514131211, 0x181F1E1D1C1B1A19};
|
38
38
|
#define STORE256(a, b) _mm256_store_si256((__m256i *)&(a), b)
|
39
39
|
#define STORE256u(a, b) _mm256_storeu_si256((__m256i *)&(a), b)
|
40
40
|
#define XOR256(a, b) _mm256_xor_si256(a, b)
|
@@ -52,33 +52,37 @@ http://creativecommons.org/publicdomain/zero/1.0/
|
|
52
52
|
</xsl:template>
|
53
53
|
|
54
54
|
<xsl:template match="gcc">
|
55
|
-
<!-- What follows is a shameless hack to avoid -march=native on aarch64 with clang -->
|
56
|
-
<xsl:if test=".= '-march=native'">
|
57
|
-
<xsl:text>ifneq ($(UNAME_M)
|
55
|
+
<!-- What follows is a shameless hack to avoid -march/-mtune=native on arm64/aarch64 with clang -->
|
56
|
+
<xsl:if test=".= '-march=native' or .= '-mtune=native'">
|
57
|
+
<xsl:text>ifneq ($(UNAME_M),aarch64)
|
58
|
+
ifneq ($(UNAME_S),Darwin)
|
58
59
|
</xsl:text>
|
59
60
|
</xsl:if>
|
60
61
|
<xsl:text>CFLAGS := $(CFLAGS) </xsl:text>
|
61
62
|
<xsl:value-of select="."/>
|
62
63
|
<xsl:text>
|
63
64
|
</xsl:text>
|
64
|
-
<xsl:if test=".= '-march=native'">
|
65
|
+
<xsl:if test=".= '-march=native' or .= '-mtune=native'">
|
65
66
|
<xsl:text>endif
|
67
|
+
endif
|
66
68
|
</xsl:text>
|
67
69
|
</xsl:if>
|
68
70
|
</xsl:template>
|
69
71
|
|
70
72
|
<xsl:template match="gas">
|
71
|
-
<!-- What follows is a shameless hack to avoid -march=native on aarch64 with clang -->
|
72
|
-
<xsl:if test=".= '-march=native'">
|
73
|
-
<xsl:text>ifneq ($(UNAME_M)
|
73
|
+
<!-- What follows is a shameless hack to avoid -march/-mtune=native on arm64/aarch64 with clang -->
|
74
|
+
<xsl:if test=".= '-march=native' or .= '-mtune=native'">
|
75
|
+
<xsl:text>ifneq ($(UNAME_M),aarch64)
|
76
|
+
ifneq ($(UNAME_S),Darwin)
|
74
77
|
</xsl:text>
|
75
78
|
</xsl:if>
|
76
79
|
<xsl:text>ASMFLAGS := $(ASMFLAGS) </xsl:text>
|
77
80
|
<xsl:value-of select="."/>
|
78
81
|
<xsl:text>
|
79
82
|
</xsl:text>
|
80
|
-
<xsl:if test=".= '-march=native'">
|
83
|
+
<xsl:if test=".= '-march=native' or .= '-mtune=native'">
|
81
84
|
<xsl:text>endif
|
85
|
+
endif
|
82
86
|
</xsl:text>
|
83
87
|
</xsl:if>
|
84
88
|
</xsl:template>
|
@@ -200,9 +204,11 @@ ifeq ($(UNAME_S),Linux)
|
|
200
204
|
ASMFLAGS :=
|
201
205
|
endif
|
202
206
|
ifeq ($(UNAME_S),Darwin)
|
203
|
-
ASMFLAGS := -x assembler-with-cpp -Wa,-defsym,
|
207
|
+
ASMFLAGS := -x assembler-with-cpp -Wa,-defsym,old_gas_syntax=1 -Wa,-defsym,no_plt=1
|
208
|
+
endif
|
209
|
+
ifneq (,$(findstring mingw32,$(CC)))
|
210
|
+
ASMFLAGS := -x assembler-with-cpp -Wa,-defsym,old_gas_syntax=1 -Wa,-defsym,no_plt=1
|
204
211
|
endif
|
205
|
-
|
206
212
|
UNAME_M := $(shell uname -m)
|
207
213
|
|
208
214
|
</xsl:text>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sleeping_kangaroo12
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sarun Rattanasiri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -62,6 +62,7 @@ extensions:
|
|
62
62
|
- ext/Rakefile
|
63
63
|
extra_rdoc_files: []
|
64
64
|
files:
|
65
|
+
- ".yardopts"
|
65
66
|
- LICENSE.md
|
66
67
|
- README.md
|
67
68
|
- ext/Rakefile
|
@@ -107,8 +108,8 @@ licenses:
|
|
107
108
|
- BSD-3-Clause
|
108
109
|
metadata:
|
109
110
|
homepage_uri: https://github.com/the-cave/sleeping-kangaroo12
|
110
|
-
source_code_uri: https://github.com/the-cave/sleeping-kangaroo12/tree/v0.0.
|
111
|
-
documentation_uri: https://rubydoc.info/gems/sleeping_kangaroo12/0.0.
|
111
|
+
source_code_uri: https://github.com/the-cave/sleeping-kangaroo12/tree/v0.0.6
|
112
|
+
documentation_uri: https://rubydoc.info/gems/sleeping_kangaroo12/0.0.6
|
112
113
|
bug_tracker_uri: https://github.com/the-cave/sleeping-kangaroo12/issues
|
113
114
|
post_install_message:
|
114
115
|
rdoc_options: []
|
@@ -125,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
126
|
- !ruby/object:Gem::Version
|
126
127
|
version: '0'
|
127
128
|
requirements: []
|
128
|
-
rubygems_version: 3.
|
129
|
+
rubygems_version: 3.3.7
|
129
130
|
signing_key:
|
130
131
|
specification_version: 4
|
131
132
|
summary: KangarooTwelve, the hash algorithm, native binding for Ruby
|