[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet-scheme] 03/03: hashcode: Adjust to conventional naming.
From: |
gnunet |
Subject: |
[gnunet-scheme] 03/03: hashcode: Adjust to conventional naming. |
Date: |
Sun, 20 Nov 2022 20:50:41 +0100 |
This is an automated email from the git hooks/post-receive script.
maxime-devos pushed a commit to branch master
in repository gnunet-scheme.
commit e57fe1489d50d10d541cf3309e3eda23e46e168d
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Sun Nov 20 19:37:16 2022 +0100
hashcode: Adjust to conventional naming.
* gnu/gnunet/hashcode.scm
(hashcode-bit-length): Rename to hashcode:512-bit-length.
(short-hashcode-bit-length): Rename to hashcode:256-bit-length.
(hashcode-u8-length): Rename to hashcode:512-u8-length.
(short-hashcode-u8-length): Rename to hashcode:256-u8-length.
(<hashcode>): Rename to <hashcode:512>.
(<short-hashcode>): Rename to <hashcode:256>.
(make-hashcode/share): Rename to make-hashcode:512/share.
(make-short-hashcode/share): Rename to make-hashcode:256/share.
(make-hashcode): Rename to make-hashcode:512.
(make-short-hashcode): Rename to make-hashcode:256.
(hashcode?): Rename to hashcode:512?.
(short-hashcode?): Rename to hashcode:256?.
(bv->hashcode): Rename to bv->hashcode:512.
(bv->short-hashcode): Rename to bv->hashcode:256.
(hashcode->bv): Rename to hashcode:512->bv.
(short-hashcode->bv): Rename to hashcode:256->bv.
---
gnu/gnunet/fs/uri.scm | 8 +++----
gnu/gnunet/hashcode-ascii.scm | 8 +++----
gnu/gnunet/hashcode.scm | 54 +++++++++++++++++++++----------------------
3 files changed, 35 insertions(+), 35 deletions(-)
diff --git a/gnu/gnunet/fs/uri.scm b/gnu/gnunet/fs/uri.scm
index d2255d5..a44b4be 100644
--- a/gnu/gnunet/fs/uri.scm
+++ b/gnu/gnunet/fs/uri.scm
@@ -103,16 +103,16 @@
;; Content hash key
(define-record-type (<content-hash-key> %make-content-hash-key chk?)
(fields ;; Hash of the original content, used for encryption.
- ;; Of type <hash-code>.
+ ;; Of type <hashcode:512>.
(immutable key chk-key)
;; Hash of the encrypted content, used for querying.
- ;; Of type <hash-code>
+ ;; Of type <hashcode:512>
(immutable query chk-query)))
(define (make-chk key query)
"Construct a <content-hash-key>"
- (assert (hashcode? key))
- (assert (hashcode? query))
+ (assert (hashcode:512? key))
+ (assert (hashcode:512? query))
(%make-content-hash-key key query))
;; Information needed to retrieve a file (content-hash-key
diff --git a/gnu/gnunet/hashcode-ascii.scm b/gnu/gnunet/hashcode-ascii.scm
index 95d8d36..bb5e29b 100644
--- a/gnu/gnunet/hashcode-ascii.scm
+++ b/gnu/gnunet/hashcode-ascii.scm
@@ -35,7 +35,7 @@
#;(define hashcode-ascii-length 103)
(define (hashcode->ascii hashcode)
- "Convert a <hashcode> to ASCII encoding. The ASCII encoding is rather
+ "Convert a <hashcode:512> to ASCII encoding. The ASCII encoding is rather
GNUnet specific. It was chosen such that it only uses characters
in [0-9A-V], can be produced without complex arithmetics and uses a
small number of characters. The GNUnet encoding uses 103
@@ -44,11 +44,11 @@ characters.
@var{block} the hash code"
(data->string (hashcode->bv hashcode)))
- (define (ascii->hashcode ascii)
+ (define (ascii->hashcode:512 ascii)
"Convert ASCII encoding back to hash code.
@var{ascii} the encoding
Return @lisp{#f} in case of an encoding error."
(let ((bv (guard (c ((bogus-crockford-base32hex? c) #false))
- (string->data ascii hashcode-u8-length))))
- (and bv (bv->hashcode bv)))))
+ (string->data ascii hashcode:512-u8-length))))
+ (and bv (bv->hashcode:512 bv)))))
diff --git a/gnu/gnunet/hashcode.scm b/gnu/gnunet/hashcode.scm
index a19884c..a5f9994 100644
--- a/gnu/gnunet/hashcode.scm
+++ b/gnu/gnunet/hashcode.scm
@@ -20,25 +20,25 @@
;; Extracted from src/include/gnunet_common.h
(library (gnu gnunet hashcode)
- (export hashcode-bit-length hashcode-u8-length
- short-hashcode-bit-length short-hashcode-u8-length
- hashcode? short-hashcode?
- make-hashcode/share make-hashcode
- make-short-hashcode/share make-short-hashcode
- hashcode->slice short-hashcode->slice)
+ (export hashcode:512-bit-length hashcode:256-u8-length
+ hashcode:512-bit-length hashcode:256-u8-length
+ hashcode:512? hashcode:256?
+ make-hashcode:512/share make-hashcode:512
+ make-hashcode:256/share make-hashcode:256
+ hashcode:512->slice hashcode:256->slice)
(import (rnrs base)
(gnu gnunet utils bv-slice)
(rnrs records syntactic))
- (define hashcode-bit-length 512)
- (define short-hashcode-bit-length 256)
- (define hashcode-u8-length (/ hashcode-bit-length 8))
- (define short-hashcode-u8-length (/ short-hashcode-bit-length 8))
+ (define hashcode:512-bit-length 512)
+ (define hashcode:256-bit-length 256)
+ (define hashcode:512-u8-length (/ hashcode:512-bit-length 8))
+ (define hashcode:256-u8-length (/ hashcode:256-bit-length 8))
;; A 512-bit hashcode. These are the default length for GNUnet,
;; using SHA-512.
- (define-record-type (<hashcode> make-hashcode/share hashcode?)
- (fields (immutable slice hashcode-slice))
+ (define-record-type (<hashcode:512> make-hashcode:512/share hashcode:512?)
+ (fields (immutable slice hashcode:512-slice))
(opaque #t)
(sealed #t)
(protocol
@@ -47,19 +47,19 @@
"Make a hashcode, containing @var{slice} (a readable
@code{/hashcode:512} bytevector slice). @var{slice} may not be mutated
while the constructed hashcode is in use."
- (assert (= (slice-length slice) hashcode-u8-length))
+ (assert (= (slice-length slice) hashcode:512-u8-length))
(slice/read-only slice)))))
- (define (make-hashcode slice)
+ (define (make-hashcode:512 slice)
"Make a hashcode, containing @var{slice} (a readable @code{/hashcode:512}
bytevector slice). @var{slice} may not be mutated while the constructed
hashcode is in use."
- (make-hashcode/share (slice-copy/read-only slice)))
+ (make-hashcode:512/share (slice-copy/read-only slice)))
;; A 256-bit hashcode. Used under special conditions, like when space
;; is critical and security is not impacted by it.
- (define-record-type (<short-hashcode> make-short-hashcode/share
short-hashcode?)
- (fields (immutable slice short-hashcode-slice))
+ (define-record-type (<hashcode:256> make-hashcode:256/share hashcode:256?)
+ (fields (immutable slice hashcode:256-slice))
(opaque #t)
(sealed #t)
(protocol
@@ -68,22 +68,22 @@ hashcode is in use."
"Make a short hashcode, containing @var{slice} (a readable
@code{/hashcode:256} bytevector slice). @var{slice} may not be mutated
while the constructed short hashcode is in use."
- (assert (= (slice-length slice) short-hashcode-u8-length))
+ (assert (= (slice-length slice) hashcode:256-u8-length))
(slice/read-only slice)))))
- (define (bv->hashcode bv)
+ (define (bv->hashcode:512 bv)
"Read a hashcode from a bytevector (deprecated)."
- (make-hashcode (bv-slice/read-only bv)))
- (define (bv->short-hashcode bv)
+ (make-hashcode:512 (bv-slice/read-only bv)))
+ (define (bv->hashcode:256 bv)
"Read a short hashcode from a bytevector (deprecated)."
- (make-short-hashcode (bv-slice/read-only bv)))
+ (make-hashcode:256 (bv-slice/read-only bv)))
- (define (hashcode->bv hashcode)
+ (define (hashcode:512->bv hashcode)
"Extract the bytevector corresponding to @var{hashcode}
(read-only)"
- (slice-copy/bytevector (hashcode-slice hashcode)))
+ (slice-copy/bytevector (hashcode:512-slice hashcode)))
- (define (short-hashcode->bv hashcode)
- "Extract the bytevector corresponding to @var{short-hashcode}
+ (define (hashcode:256->bv hashcode)
+ "Extract the bytevector corresponding to @var{hashcode}
(read-only)"
- (slice-copy/bytevector (short-hashcode-slice hashcode))))
+ (slice-copy/bytevector (hashcode:256-slice hashcode))))
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.