digest-vlh 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/digest-vlh.gemspec +1 -1
- data/lib/digest/vlh.rb +4 -0
- data/test/test_vlh.rb +12 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3aad14bd4a7db290cb53a63ca5683e8325a454499216815b2fd15582328980ac
|
4
|
+
data.tar.gz: 50e372f558193ea17c04c4720893534ae8e6a017c3248a74e49d54f11c205c2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3f4ebaef3adea44c9d0f7d95ce00034d5d309792896e44cff17a45efb343c66f8be66931013a0bc3d18fd309779ebc43a927ef4fb85614bcdad1b2f9c3953be
|
7
|
+
data.tar.gz: 23d294c34e3c098fefca096b53a3a411e1c7455b2f3139c2ea5d5b9531e681ffc57439be8f6a58726c7084f4cd85cb90cd6ab64e32faba7f1d5e4f112b77a07e
|
data/digest-vlh.gemspec
CHANGED
data/lib/digest/vlh.rb
CHANGED
@@ -28,12 +28,16 @@ module Digest
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def digest(str = "")
|
31
|
+
return "" if @len <= 0
|
32
|
+
|
31
33
|
update(str)
|
32
34
|
digest = (expand_digest.to_i(BASE) % div_num).to_s
|
33
35
|
digest.rjust(@len, "0")
|
34
36
|
end
|
35
37
|
|
36
38
|
def hexdigest(str = "")
|
39
|
+
return "" if @len <= 0
|
40
|
+
|
37
41
|
update(str)
|
38
42
|
digest = (expand_digest.to_i(BASE) % div_hex).to_s(BASE)
|
39
43
|
digest.rjust(@len, "0")
|
data/test/test_vlh.rb
CHANGED
@@ -53,4 +53,16 @@ class VLHTest < Test::Unit::TestCase
|
|
53
53
|
|
54
54
|
assert_equal("029b8a3b0e189ad1", digest)
|
55
55
|
end
|
56
|
+
|
57
|
+
def test_zero_length_hexdigest
|
58
|
+
digest = Digest::VLH.hexdigest("Lorem ipsum", 0)
|
59
|
+
|
60
|
+
assert_equal(0, digest.length)
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_zero_length_digest
|
64
|
+
digest = Digest::VLH.digest("Lorem ipsum", 0)
|
65
|
+
|
66
|
+
assert_equal(0, digest.length)
|
67
|
+
end
|
56
68
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: digest-vlh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SNakano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: a tiny implement variable length ouptput hash
|
14
14
|
email:
|