diff --git a/crossfire/not-crypto.rkt b/crossfire/not-crypto.rkt index 74b9851..b4812f5 100644 --- a/crossfire/not-crypto.rkt +++ b/crossfire/not-crypto.rkt @@ -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) diff --git a/static/run.rkt b/static/run.rkt index a6e5da8..95f822e 100644 --- a/static/run.rkt +++ b/static/run.rkt @@ -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")))