summaryrefslogtreecommitdiff
path: root/guix/openpgp.scm
diff options
context:
space:
mode:
authorJakub Kądziołka <kuba@kadziolka.net>2020-07-23 21:43:06 +0200
committerJakub Kądziołka <kuba@kadziolka.net>2020-07-23 21:43:06 +0200
commitd726b954baaeff876ce9728e00920fa45f529f9a (patch)
tree4b767b7586a1082dd2691bc33c3e45ace044e6e5 /guix/openpgp.scm
parent9a74a7db8626bc139307d115f5cec2648f5273ad (diff)
parente165a2492d73d37c8b95d6970d453b9d88911ee6 (diff)
Merge branch 'master' into core-updates
Conflicts: gnu/packages/ruby.scm
Diffstat (limited to 'guix/openpgp.scm')
-rw-r--r--guix/openpgp.scm21
1 files changed, 4 insertions, 17 deletions
diff --git a/guix/openpgp.scm b/guix/openpgp.scm
index b74f8ff5bf..33c851255b 100644
--- a/guix/openpgp.scm
+++ b/guix/openpgp.scm
@@ -1029,23 +1029,10 @@ there is no limit."
(define (crc24 bv)
"Compute a CRC24 as described in RFC4880, Section 6.1."
- (define poly #x1864cfb)
-
- (let loop ((crc #xb704ce)
- (index 0))
- (if (= index (bytevector-length bv))
- (logand crc #xffffff)
- (let ((crc (logxor (ash (bytevector-u8-ref bv index) 16)
- crc)))
- (let inner ((i 0)
- (crc crc))
- (if (< i 8)
- (let ((crc (ash crc 1)))
- (inner (+ i 1)
- (if (zero? (logand crc #x1000000))
- crc
- (logxor crc poly))))
- (loop crc (+ index 1))))))))
+ ;; We used to have it implemented in Scheme but the C version here makes
+ ;; 'load-keyring-from-reference' 18% faster when loading the 72
+ ;; ASCII-armored files of today's Guix keyring.
+ (bytevector->uint (bytevector-hash bv (hash-algorithm crc24-rfc2440))))
(define %begin-block-prefix "-----BEGIN ")
(define %begin-block-suffix "-----")