Commit 54d99366 authored by amirouche's avatar amirouche

argon2: update to 0~20161029-1 (ubuntu 17.10)

- add %argon-type-argon2-d, %argon-type-argon2-i, %argon-type-argon2-id private variables
- encoded-length: add argon-type parameter
- hash-secret: change urandom parameter to be the relevant variable
- hash-secret: pass %argon-type-argon2-i as argon-type argument to encoded-length
parent 26160b05
......@@ -17,6 +17,8 @@
;;
;; https://martinfowler.com/articles/web-security-basics.html
;;
;; argon2 version 0~20161029-1
;;
(define-module (argon2))
(use-modules (ice-9 binary-ports))
......@@ -46,7 +48,11 @@
(let ((function (dynamic-func function-name shared-object)))
(pointer->procedure return-value function arguments)))))
(define argon2 (dynamic-link* "/usr/lib/x86_64-linux-gnu/libargon2.so"))
(define argon2 (dynamic-link* "/usr/lib/x86_64-linux-gnu/libargon2.so")) ;; TODO
(define %argon-type-argon2-d 0)
(define %argon-type-argon2-i 1)
(define %argon-type-argon2-id 2)
(define error-message
(let ((func (argon2 '*
......@@ -62,9 +68,10 @@
uint32
uint32
uint32
uint32)))
(lambda (time-cost memory-cost parallelism salt-length hash-length)
(func time-cost memory-cost parallelism salt-length hash-length))))
uint32
int)))
(lambda (time-cost memory-cost parallelism salt-length hash-length argon-type)
(func time-cost memory-cost parallelism salt-length hash-length argon-type))))
(define argon2i-hash-encode
(let ((func (argon2 int
......@@ -98,16 +105,17 @@
(define-public (hash-secret password pepper)
"Hash PASSWORD and PEPPER"
(let ((password* (string-append password pepper)))
(let ((time-cost 2) ;; default values from argon2_cffi
(memory-cost 512)
(parallelism 2)
(length 16)
(salt (urandom 16)))
(let* ((time-cost 2) ;; default values from argon2_cffi
(memory-cost 512)
(parallelism 2)
(length 16)
(salt (urandom length)))
(let ((total (encoded-length time-cost
memory-cost
parallelism
length
length)))
length
%argon-type-argon2-i)))
(utf8->string (argon2i-hash-encode time-cost
memory-cost
parallelism
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment