crypto-lite 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,87 +1,90 @@
1
- ###
2
- # to run use
3
- # ruby -I ./lib -I ./test test/test_hash_sha.rb
4
-
5
-
6
- require 'helper'
7
-
8
-
9
- class TestHashSha < MiniTest::Test
10
-
11
- SHA256_ABC = 'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad'
12
- SHA256_A = 'ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb'
13
- SHA256_B = '3e23e8160039594a33894f6564e1b1348bbd7a0088d42c4acb73eeaed59c009d'
14
- SHA256_C = '2e7d2c03a9507ae265ecf5b5356885a53393a2029d241394997265a1a25aefc6'
15
-
16
-
17
- BIN_TESTS = [
18
- ['', 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'],
19
- ['Hello, Cryptos!', '33eedea60b0662c66c289ceba71863a864cf84b00e10002ca1069bf58f9362d5'],
20
-
21
- ['Blockchain 1', '223aae3830e87aff41db07714983671429a74fb7064646e27ab62adbdc892cd1'],
22
- ['Blockchain 2', '8f4b5a896e78f680de2c141d25533e8c9207c9ee0d9b09c22a5a01d7992e7d1b'],
23
- ['Blockchain 3', 'f9f5e7d64f3a93f071900a73d34b2b722867adcb09345a21a25b5cd7f8b41254'],
24
- ['Blockchain 4', '69580cfb9a134395106ac27de53595cc41fb9940dcc298082c87144932a983a9'],
25
- ['Blockchain 12', 'f94455d34e7b32dc7dac780fb94a5e958f0d7e2da4cc6500505d5daed719c227'],
26
- ['Blockchain 13', '0cedb5e229c9582a35ec291ccb172b3f7c76a20c7f645e08d24ece8d5692e153'],
27
- ]
28
-
29
-
30
- def test_bin
31
- BIN_TESTS.each do |item|
32
- assert_equal item[1], sha256( item[0].b )
33
- assert_equal item[1], sha256( item[0].b, engine: 'openssl' )
34
- end
35
- end
36
-
37
-
38
- def test_abc
39
- ['abc',
40
- 'abc'.b,
41
- "\x61\x62\x63",
42
- 0x616263
43
- ].each do |input|
44
- assert_equal SHA256_ABC, sha256( input )
45
- assert_equal SHA256_ABC, sha256( input, engine: 'openssl' )
46
- end
47
-
48
- ['616263',
49
- '0x616263',
50
- '0X616263'
51
- ].each do |input|
52
- assert_equal SHA256_ABC, sha256( hex: input )
53
- end
54
- ## pp sha256hex( 'hello' ) -- fails - uses non-hex chars
55
-
56
- # a = dec (97), hex (61), bin (01100001)
57
-
58
- [ 'a',
59
- "\x61",
60
- 0b01100001,
61
- 0x61
62
- ].each do |input|
63
- assert_equal SHA256_A, sha256( input )
64
- assert_equal SHA256_A, sha256( input, engine: 'openssl' )
65
- end
66
-
67
- ['61',
68
- '0x61',
69
- '0X61'
70
- ].each do |input|
71
- assert_equal SHA256_A, sha256( hex: input )
72
- end
73
-
74
- [ 'b',
75
- 0b01100010
76
- ].each do |input|
77
- assert_equal SHA256_B, sha256( input )
78
- end
79
-
80
- [ 'c',
81
- 0b01100011
82
- ].each do |input|
83
- assert_equal SHA256_C, sha256( input )
84
- end
85
- end
86
-
87
- end # class TestHashSha
1
+ ###
2
+ # to run use
3
+ # ruby -I ./lib -I ./test test/test_hash_sha.rb
4
+
5
+
6
+ require 'helper'
7
+
8
+
9
+ class TestHashSha < MiniTest::Test
10
+
11
+ SHA256_ABC = 'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad'
12
+ SHA256_A = 'ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb'
13
+ SHA256_B = '3e23e8160039594a33894f6564e1b1348bbd7a0088d42c4acb73eeaed59c009d'
14
+ SHA256_C = '2e7d2c03a9507ae265ecf5b5356885a53393a2029d241394997265a1a25aefc6'
15
+
16
+
17
+ BIN_TESTS = [
18
+ ['', 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'],
19
+ ['Hello, Cryptos!', '33eedea60b0662c66c289ceba71863a864cf84b00e10002ca1069bf58f9362d5'],
20
+
21
+ ['Blockchain 1', '223aae3830e87aff41db07714983671429a74fb7064646e27ab62adbdc892cd1'],
22
+ ['Blockchain 2', '8f4b5a896e78f680de2c141d25533e8c9207c9ee0d9b09c22a5a01d7992e7d1b'],
23
+ ['Blockchain 3', 'f9f5e7d64f3a93f071900a73d34b2b722867adcb09345a21a25b5cd7f8b41254'],
24
+ ['Blockchain 4', '69580cfb9a134395106ac27de53595cc41fb9940dcc298082c87144932a983a9'],
25
+ ['Blockchain 12', 'f94455d34e7b32dc7dac780fb94a5e958f0d7e2da4cc6500505d5daed719c227'],
26
+ ['Blockchain 13', '0cedb5e229c9582a35ec291ccb172b3f7c76a20c7f645e08d24ece8d5692e153'],
27
+
28
+ ['Satoshi Nakamoto', 'a0dc65ffca799873cbea0ac274015b9526505daaaed385155425f7337704883e'],
29
+ ['Satoshi Nakamot0', '73d607aab917435d5e79857769996c95027d4e42172698e0776e1295e285730e'],
30
+ ]
31
+
32
+
33
+ def test_bin
34
+ BIN_TESTS.each do |item|
35
+ assert_equal item[1], sha256( item[0].b )
36
+ assert_equal item[1], sha256( item[0].b, engine: 'openssl' )
37
+ end
38
+ end
39
+
40
+
41
+ def test_abc
42
+ ['abc',
43
+ 'abc'.b,
44
+ "\x61\x62\x63",
45
+ 0x616263
46
+ ].each do |input|
47
+ assert_equal SHA256_ABC, sha256( input )
48
+ assert_equal SHA256_ABC, sha256( input, engine: 'openssl' )
49
+ end
50
+
51
+ ['616263',
52
+ '0x616263',
53
+ '0X616263'
54
+ ].each do |input|
55
+ assert_equal SHA256_ABC, sha256( hex: input )
56
+ end
57
+ ## pp sha256hex( 'hello' ) -- fails - uses non-hex chars
58
+
59
+ # a = dec (97), hex (61), bin (01100001)
60
+
61
+ [ 'a',
62
+ "\x61",
63
+ 0b01100001,
64
+ 0x61
65
+ ].each do |input|
66
+ assert_equal SHA256_A, sha256( input )
67
+ assert_equal SHA256_A, sha256( input, engine: 'openssl' )
68
+ end
69
+
70
+ ['61',
71
+ '0x61',
72
+ '0X61'
73
+ ].each do |input|
74
+ assert_equal SHA256_A, sha256( hex: input )
75
+ end
76
+
77
+ [ 'b',
78
+ 0b01100010
79
+ ].each do |input|
80
+ assert_equal SHA256_B, sha256( input )
81
+ end
82
+
83
+ [ 'c',
84
+ 0b01100011
85
+ ].each do |input|
86
+ assert_equal SHA256_C, sha256( input )
87
+ end
88
+ end
89
+
90
+ end # class TestHashSha
data/test/test_version.rb CHANGED
@@ -1,19 +1,19 @@
1
- ###
2
- # to run use
3
- # ruby -I ./lib -I ./test test/test_version.rb
4
-
5
-
6
- require 'helper'
7
-
8
-
9
- class TestVersion < MiniTest::Test
10
-
11
- def test_version
12
- pp CryptoLite.version
13
- pp CryptoLite.banner
14
- pp CryptoLite.root
15
-
16
- assert true ## (for now) everything ok if we get here
17
- end
18
-
19
- end # class TestVersion
1
+ ###
2
+ # to run use
3
+ # ruby -I ./lib -I ./test test/test_version.rb
4
+
5
+
6
+ require 'helper'
7
+
8
+
9
+ class TestVersion < MiniTest::Test
10
+
11
+ def test_version
12
+ pp CryptoLite.version
13
+ pp CryptoLite.banner
14
+ pp CryptoLite.root
15
+
16
+ assert true ## (for now) everything ok if we get here
17
+ end
18
+
19
+ end # class TestVersion
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crypto-lite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-23 00:00:00.000000000 Z
11
+ date: 2022-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: digest-sha3-patched
14
+ name: digest-lite
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -92,14 +92,14 @@ dependencies:
92
92
  requirements:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: '3.22'
95
+ version: '3.23'
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - "~>"
101
101
  - !ruby/object:Gem::Version
102
- version: '3.22'
102
+ version: '3.23'
103
103
  description: crypto-lite - cryptographic secure hash functions and public key signature
104
104
  algorithms made easy
105
105
  email: wwwmake@googlegroups.com
@@ -128,7 +128,7 @@ files:
128
128
  - test/test_hash.rb
129
129
  - test/test_hash_sha.rb
130
130
  - test/test_version.rb
131
- homepage: https://github.com/rubycoco/blockchain
131
+ homepage: https://github.com/rubycocos/blockchain
132
132
  licenses:
133
133
  - Public Domain
134
134
  metadata: {}
@@ -149,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  - !ruby/object:Gem::Version
150
150
  version: '0'
151
151
  requirements: []
152
- rubygems_version: 3.1.4
152
+ rubygems_version: 3.3.7
153
153
  signing_key:
154
154
  specification_version: 4
155
155
  summary: crypto-lite - cryptographic secure hash functions and public key signature