argon2 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.gitmodules +4 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +25 -0
- data/Rakefile +10 -0
- data/argon2.gemspec +26 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/argon2.rb +38 -0
- data/lib/argon2/version.rb +4 -0
- metadata +112 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a7a9392b4bb8cdc56418814da31cafecd75a4541
|
4
|
+
data.tar.gz: 3f3bb552897de92e5ef3f0633a24608b1fb36e2f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9cd94e1f77f4fab2eab9e4365e5e7381006eb718d24bdb6da0263c370a685cea685518488b5e13290dd6b0955b8e781f1f078bf73b2d9a1907a84244701919a4
|
7
|
+
data.tar.gz: 4c2b3f6cac4ba08e2fdfa2f3e09c98fdb493e82e57a0631aa9c52c3a9086953fe4dd5b87531f89535db72d72367026dcc423e613dc9e5ebe0935ee76591cbcf3
|
data/.gitignore
ADDED
data/.gitmodules
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Technion
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# Argon2
|
2
|
+
|
3
|
+
An FFI binding for Argon2.
|
4
|
+
This gem is unfinished.
|
5
|
+
|
6
|
+
|
7
|
+
TODO: Delete this and the text above, and describe your gem
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'argon2'
|
15
|
+
```
|
16
|
+
|
17
|
+
|
18
|
+
## Contributing
|
19
|
+
|
20
|
+
Not yet - the code is in a high state of flux.
|
21
|
+
|
22
|
+
## License
|
23
|
+
|
24
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
25
|
+
|
data/Rakefile
ADDED
data/argon2.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'argon2/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "argon2"
|
8
|
+
spec.version = Argon2::VERSION
|
9
|
+
spec.authors = ["Technion"]
|
10
|
+
spec.email = ["technion@lolware.net"]
|
11
|
+
|
12
|
+
spec.summary = %q{Argon2 Password hashing binding}
|
13
|
+
spec.description = %q{Not remotely finished Argon2 binding}
|
14
|
+
spec.homepage = "https://github.com/technion/ruby-argon2"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
spec.add_dependency 'ffi-compiler'
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
spec.add_development_dependency "minitest"
|
26
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "ruby/argon2"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/lib/argon2.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require "argon2/version"
|
2
|
+
require 'ffi'
|
3
|
+
|
4
|
+
module Argon2
|
5
|
+
module Ext
|
6
|
+
extend FFI::Library
|
7
|
+
ffi_lib './ext/phc-winner-argon2/libargon2.so'
|
8
|
+
#/**
|
9
|
+
# * Function to hash the inputs in the memory-hard fashion (uses Argon2i)
|
10
|
+
# * @param out Pointer to the memory where the hash digest will be written
|
11
|
+
# * @param outlen Digest length in bytes
|
12
|
+
# * @param in Pointer to the input (password)
|
13
|
+
# * @param inlen Input length in bytes
|
14
|
+
# * @param salt Pointer to the salt
|
15
|
+
# * @param saltlen Salt length in bytes
|
16
|
+
# * @pre @a out must have at least @a outlen bytes allocated
|
17
|
+
# * @pre @a in must be at least @inlen bytes long
|
18
|
+
# * @pre @a saltlen must be at least @saltlen bytes long
|
19
|
+
# * @return Zero if successful, 1 otherwise.
|
20
|
+
# */
|
21
|
+
#int hash_argon2i(void *out, size_t outlen, const void *in, size_t inlen,
|
22
|
+
# const void *salt, size_t saltlen, unsigned int t_cost,
|
23
|
+
# unsigned int m_cost);
|
24
|
+
|
25
|
+
attach_function :hash_argon2i, [:pointer, :size_t, :pointer, :size_t,
|
26
|
+
:pointer, :size_t, :uint, :uint ], :int, :blocking => true
|
27
|
+
end
|
28
|
+
|
29
|
+
def Argon2.hash_argon2i(password, salt)
|
30
|
+
result = ''
|
31
|
+
FFI::MemoryPointer.new(:char, 32) do |buffer|
|
32
|
+
ret = Ext.hash_argon2i(buffer, 32, password, password.length, salt, salt.length, 2, (1<<16))
|
33
|
+
fail "Hash failed" unless ret == 0
|
34
|
+
result = buffer.read_string(32)
|
35
|
+
end
|
36
|
+
result.unpack('H*').join
|
37
|
+
end
|
38
|
+
end
|
metadata
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: argon2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Technion
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-11-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: ffi-compiler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.10'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.10'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Not remotely finished Argon2 binding
|
70
|
+
email:
|
71
|
+
- technion@lolware.net
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".gitmodules"
|
78
|
+
- ".travis.yml"
|
79
|
+
- Gemfile
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- argon2.gemspec
|
84
|
+
- bin/console
|
85
|
+
- bin/setup
|
86
|
+
- lib/argon2.rb
|
87
|
+
- lib/argon2/version.rb
|
88
|
+
homepage: https://github.com/technion/ruby-argon2
|
89
|
+
licenses:
|
90
|
+
- MIT
|
91
|
+
metadata: {}
|
92
|
+
post_install_message:
|
93
|
+
rdoc_options: []
|
94
|
+
require_paths:
|
95
|
+
- lib
|
96
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
requirements: []
|
107
|
+
rubyforge_project:
|
108
|
+
rubygems_version: 2.4.8
|
109
|
+
signing_key:
|
110
|
+
specification_version: 4
|
111
|
+
summary: Argon2 Password hashing binding
|
112
|
+
test_files: []
|