Introduction
Introduction Statistics Contact Development Disclaimer Help
If not on OpenBSD use /dev/random - pee - Pee a password manager;Pee - because …
git clone git://vernunftzentrum.de/pee.git
Log
Files
Refs
LICENSE
---
commit d81668d38fa2e3d5fb6d2c0878bd614b33a7b929
parent 404420ba6d6fa7e5376ce613f3803a65b2ca94ef
Author: Christian Kellermann <[email protected]>
Date: Sat, 9 Jan 2016 12:45:05 +0100
If not on OpenBSD use /dev/random
Diffstat:
crypto-helper.scm | 8 +++++++-
pee.scm | 2 +-
2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/crypto-helper.scm b/crypto-helper.scm
@@ -1,4 +1,4 @@
-(module crypto-helper (arc4random hash-passphrase)
+(module crypto-helper (random-bytes hash-passphrase)
(import chicken scheme foreign)
(use blob-hexadecimal (srfi 4))
(foreign-declare "#include \"blake2.h\"")
@@ -24,6 +24,12 @@
(error "Unable to hash passphrase with blake2s")
out)))
+ (define (random-bytes len)
+ (cond-expand (openbsd:
+ (arc4random len))
+ (else
+ (with-input-from-file "/dev/random" (lambda () (read-u…
+
(define (arc4random len)
(let ((buf (make-blob len)))
((foreign-lambda
diff --git a/pee.scm b/pee.scm
@@ -35,7 +35,7 @@
(else
(let ((new (filter (lambda (n)
(< n (string-length password-chars)))
- (u8vector->list (arc4random len)))))
+ (u8vector->list (random-bytes len)))))
(loop (- len (length new)) (append new idx)))))))
(list->string (map (lambda (i)
(string-ref password-chars i))
You are viewing proxied material from vernunftzentrum.de. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.