From 0a94dc63964c88903079c0a040162439fe07a306 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 21 Jul 2017 14:32:24 +0200 Subject: base32: Export the base32 charsets. * guix/base32.scm (%nix-base32-charset, %rfc4648-base32-charset): New variables. --- guix/base32.scm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/guix/base32.scm b/guix/base32.scm index 7b2e2a6712..49f191ba26 100644 --- a/guix/base32.scm +++ b/guix/base32.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2015 Ludovic Courtès +;;; Copyright © 2012, 2015, 2017 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -28,6 +28,8 @@ bytevector->nix-base32-string base32-string->bytevector nix-base32-string->bytevector + %nix-base32-charset + %rfc4648-base32-charset &invalid-base32-character invalid-base32-character? invalid-base32-character-value @@ -152,11 +154,17 @@ the previous application or INIT." #\a #\b #\c #\d #\f #\g #\h #\i #\j #\k #\l #\m #\n #\p #\q #\r #\s #\v #\w #\x #\y #\z)) +(define %nix-base32-charset + (list->char-set (vector->list %nix-base32-chars))) + (define %rfc4648-base32-chars #(#\a #\b #\c #\d #\e #\f #\g #\h #\i #\j #\k #\l #\m #\n #\o #\p #\q #\r #\s #\t #\u #\v #\w #\x #\y #\z #\2 #\3 #\4 #\5 #\6 #\7)) +(define %rfc4648-base32-charset + (list->char-set (vector->list %rfc4648-base32-chars))) + (define bytevector->base32-string (make-bytevector->base32-string bytevector-quintet-fold %rfc4648-base32-chars)) -- cgit v1.2.3