From a2cbbb743da26abc3a1bdbcd9af2d07018c2a8a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sat, 28 Dec 2013 15:41:48 +0100 Subject: pk-crypto: 'canonical-sexp-nth-data' returns a symbol for "tokens". * guix/pk-crypto.scm (token-string?): New procedure. (canonical-sexp-nth-data): Return a symbol when the element is a "token", and a bytevector otherwise. (latin1-string->bytevector): Remove. (hash-data->bytevector): Adjust accordingly. * tests/pk-crypto.scm ("canonical-sexp-nth"): Adjust accordingly. Add octet string example. --- tests/pk-crypto.scm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/pk-crypto.scm b/tests/pk-crypto.scm index 85f8f9407e..8da533f5b2 100644 --- a/tests/pk-crypto.scm +++ b/tests/pk-crypto.scm @@ -108,8 +108,9 @@ (gc) (test-equal "canonical-sexp-nth-data" - '("Name" "Otto" "Meier" #f #f #f) - (let ((lst (string->canonical-sexp "(Name Otto Meier (address Burgplatz))"))) + `(Name Otto Meier #f ,(base16-string->bytevector "123456") #f) + (let ((lst (string->canonical-sexp + "(Name Otto Meier (address Burgplatz) #123456#)"))) (unfold (cut > <> 5) (cut canonical-sexp-nth-data lst <>) 1+ -- cgit v1.2.3