add crypto-wipe
This commit is contained in:
parent
9bc5eece92
commit
9be3ce452f
|
@ -105,3 +105,9 @@
|
|||
(define (crypto-lock-make-nonce)
|
||||
(crypto-random-bytes 24))
|
||||
(provide crypto-lock-make-key crypto-lock-make-nonce)
|
||||
|
||||
;; misc
|
||||
|
||||
(define/ffi crypto-wipe
|
||||
(_fun (buf : _u8vector) (sz : _size = (u8vector-length buf)) -> _void))
|
||||
(provide crypto-wipe)
|
||||
|
|
|
@ -19,3 +19,12 @@
|
|||
(require "../crossfire/not-crypto.rkt")
|
||||
|
||||
(crypto-sign-public-key #"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
|
||||
|
||||
(define key (crypto-lock-make-key))
|
||||
(define nonce (crypto-lock-make-nonce))
|
||||
(define pt #"hello world")
|
||||
|
||||
(define-values [ct mac] (crypto-lock key nonce pt))
|
||||
|
||||
(displayln (crypto-unlock key nonce mac ct))
|
||||
(displayln (crypto-unlock key nonce mac (bytes-append ct #"abcd")))
|
||||
|
|
Loading…
Reference in New Issue