h 3.0.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6b16434031f5b5e709a131a094e25065701e207c
4
- data.tar.gz: 1c0e43f7f37fa7727007eaae29bffb7fa5d9c3ed
3
+ metadata.gz: c0ae3b158ff41bdca434eaaacd48a2c2e9ebd79d
4
+ data.tar.gz: e5019914b6044ea05a060636a8778e9d0c128640
5
5
  SHA512:
6
- metadata.gz: f35d34fc2ea767ec2c23dff59ebead4b2e4c51d58e7b0f7c0d47146a5957ef951a2a60419db4a10706f3e60edc0f63f90d98e05a8658e9d0ca217ab750484669
7
- data.tar.gz: ef42be5f74e5450381a4e50ce75a167f2411ab7f46eed24423a53bf93ea9bc3a7057592d06d0434692288817075dd69f1443a63c1869c3cdea5c7a5e30207bd3
6
+ metadata.gz: e9fc33a412e2a2a90f1780c4749c4b7e1fe9a7b547983d40e1685a2ee49afa7f1e40d405fe4e89fff04d6b5b44336c1b578a6341e7cbf73a8dca7d05b323f752
7
+ data.tar.gz: 45bab5002bd34e05e5116b90bca05f6416744cd75063ebee381bc241441dc3f676f4e1b1824523f350b176545ce29b92e509b55b285ed2bf7910c3e5a6abf011
data/README.md CHANGED
@@ -25,10 +25,10 @@ Generate a digest from the system:
25
25
  $ echo "my-secret" > ~/.h
26
26
 
27
27
  $ h p@ssw0rd
28
- ff665753fe1d26bd6a721760fe3b6623568a9c51962d6bfc9b7fc73d1f1c14d5
28
+ +KsELdbw7gM0e2lQsnCskf1albEXgl9MtXgrmvYkIaM=
29
29
 
30
30
  $ h シークレット
31
- 069f550ba39da8f87b0229ad5e3d75814c472b1c5a109ff236f9184f49fb3a25
31
+ NaNvnGJGWWzzU9DlRSRKZQQER1/9/libXrrghMgBWbU=
32
32
  ```
33
33
 
34
34
  Same operations, with Ruby:
@@ -38,8 +38,8 @@ require "h"
38
38
 
39
39
  builder = H::Builder.new("my-secret")
40
40
 
41
- builder.call("p@ssw0rd") # => ff665753fe1d26bd6a721760fe3b6623568a9c51962d6bfc9b7fc73d1f1c14d5
42
- builder.call("シークレット") # => 069f550ba39da8f87b0229ad5e3d75814c472b1c5a109ff236f9184f49fb3a25
41
+ builder.call("p@ssw0rd") # => +KsELdbw7gM0e2lQsnCskf1albEXgl9MtXgrmvYkIaM=
42
+ builder.call("シークレット") # => NaNvnGJGWWzzU9DlRSRKZQQER1/9/libXrrghMgBWbU=
43
43
  ```
44
44
 
45
45
  ## Status
data/Rakefile CHANGED
@@ -13,5 +13,4 @@ namespace :test do
13
13
  end
14
14
  end
15
15
 
16
- task(:doc_stats) { ruby '-S yard stats' }
17
- task default: %i[test doc_stats]
16
+ task default: %i[test]
@@ -1 +1 @@
1
- 3.0.0
1
+ 4.0.0
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'bundler/setup'
4
- require 'qi'
4
+ require 'h'
5
5
 
6
6
  require 'irb'
7
7
  IRB.start
data/lib/h.rb CHANGED
@@ -5,17 +5,11 @@ module H
5
5
  attr_reader :secret
6
6
 
7
7
  def initialize(secret)
8
- @secret = secret.to_s
8
+ @secret = secret
9
9
  end
10
10
 
11
11
  def call(value)
12
- ::Digest::SHA256.hexdigest(salt(value.to_s))
13
- end
14
-
15
- private
16
-
17
- def salt(value)
18
- value + secret
12
+ ::Digest::SHA256.base64digest("#{value}++#{secret}")
19
13
  end
20
14
  end
21
15
  end
@@ -3,29 +3,29 @@ require_relative '_test_helper'
3
3
  Fix.describe H::Builder do
4
4
  on :new, 'my-secret' do
5
5
  on :call, nil do
6
- it { MUST eql '186ef76e9d6a723ecb570d4d9c287487d001e5d35f7ed4a313350a407950318e' }
6
+ it { MUST eql 'NKLNPIzInF96PBmMCqZR1jFaIoHn9c1y0n8jtMam4cs=' }
7
7
  end
8
8
 
9
9
  on :call, 'p@ssw0rd' do
10
- it { MUST eql 'ff665753fe1d26bd6a721760fe3b6623568a9c51962d6bfc9b7fc73d1f1c14d5' }
10
+ it { MUST eql '+KsELdbw7gM0e2lQsnCskf1albEXgl9MtXgrmvYkIaM=' }
11
11
  end
12
12
 
13
13
  on :call, 'シークレット' do
14
- it { MUST eql '069f550ba39da8f87b0229ad5e3d75814c472b1c5a109ff236f9184f49fb3a25' }
14
+ it { MUST eql 'NaNvnGJGWWzzU9DlRSRKZQQER1/9/libXrrghMgBWbU=' }
15
15
  end
16
16
  end
17
17
 
18
18
  on :new, nil do
19
19
  on :call, nil do
20
- it { MUST eql 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' }
20
+ it { MUST eql 'z8DAYHozgPeXU0azDBSvgoT1ST2XgbDthH9JnwG0do4=' }
21
21
  end
22
22
 
23
23
  on :call, 'p@ssw0rd' do
24
- it { MUST eql 'a075d17f3d453073853f813838c15b8023b8c487038436354fe599c3942e1f95' }
24
+ it { MUST eql 'M1YbuYA4RzKHPYXaUm/GH49wLTA8JOu4WCGbt8QVOrE=' }
25
25
  end
26
26
 
27
27
  on :call, 'シークレット' do
28
- it { MUST eql '2f1a3e825632d6d5c2085839b7d82e38d9e7435d5cafb1d38801db87335ba0dd' }
28
+ it { MUST eql 'jBU9DIODvHm1tTS7LHHJ1fM/SD3dIgwbYs8sXQkttJw=' }
29
29
  end
30
30
  end
31
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: h
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cyril Kato
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-03 00:00:00.000000000 Z
11
+ date: 2017-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler