[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet-scheme] 40/49: examples/web: Don't hash the data.
From: |
gnunet |
Subject: |
[gnunet-scheme] 40/49: examples/web: Don't hash the data. |
Date: |
Sat, 25 Dec 2021 23:00:17 +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 e127bf6482ac541b3df47b5810db3bdbf17501fc
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Wed Oct 6 08:10:36 2021 +0200
examples/web: Don't hash the data.
* examples/web.scm (decode): Rename to ...
(decode/key): ... this.
(decode/data): New procedure.
(process-put-dht): Use new procedure for data.
(process-search-dht): Use new name of old procedure.
---
examples/web.scm | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/examples/web.scm b/examples/web.scm
index e087a00..f3fdc60 100644
--- a/examples/web.scm
+++ b/examples/web.scm
@@ -102,22 +102,29 @@
(dt "Standard deviation")
(dd ,(number->string (nse:estimate:standard-deviation estimate)))))
-(define (decode encoding data)
+(define (decode/key encoding data)
(match encoding
("utf-8-text"
(hash/sha512 (bv-slice/read-write (string->utf8 data))))
;; TODO other encodings
))
+(define (decode/data encoding data)
+ (match encoding
+ ("utf-8-text"
+ (bv-slice/read-write (string->utf8 data))
+ ;; TODO other encodings
+ )))
+
(define (process-put-dht dht-server parameters)
;; TODO replication level, expiration ...
(dht:put! dht-server
(string->number (assoc-ref parameters "type"))
- (decode (assoc-ref parameters "key-encoding")
- ;; TODO the key is 00000.... according to gnunet-dht-monitor
- (assoc-ref parameters "key"))
- (decode (assoc-ref parameters "data-encoding")
- (assoc-ref parameters "data"))))
+ (decode/key (assoc-ref parameters "key-encoding")
+ ;; TODO the key is 00000.... according to
gnunet-dht-monitor
+ (assoc-ref parameters "key"))
+ (decode/data (assoc-ref parameters "data-encoding")
+ (assoc-ref parameters "data"))))
(define (process-search-dht dht-server parameters)
(define what)
@@ -132,8 +139,8 @@
(signal-condition! found?))
(dht:start-get! dht-server
(string->number (assoc-ref parameters "type"))
- (decode (assoc-ref parameters "key-encoding")
- (assoc-ref parameters "key"))
+ (decode/key (assoc-ref parameters "key-encoding")
+ (assoc-ref parameters "key"))
found
#:desired-replication-level
(string->number (assoc-ref parameters "replication-level")))
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [gnunet-scheme] 09/49: examples/web: Connect to the DHT service., (continued)
- [gnunet-scheme] 09/49: examples/web: Connect to the DHT service., gnunet, 2021/12/25
- [gnunet-scheme] 10/49: dht/client: Register new get operations for processing., gnunet, 2021/12/25
- [gnunet-scheme] 12/49: dht/client: Send messages for new get operations., gnunet, 2021/12/25
- [gnunet-scheme] 13/49: dht/client: Send PUT messages., gnunet, 2021/12/25
- [gnunet-scheme] 24/49: examples/web: Put different information on separate pages., gnunet, 2021/12/25
- [gnunet-scheme] 20/49: dht/client: Call the callback on the client result., gnunet, 2021/12/25
- [gnunet-scheme] 17/49: dht/struct: Fix typo in synopsis., gnunet, 2021/12/25
- [gnunet-scheme] 14/49: Merge branch 'master' into dht, gnunet, 2021/12/25
- [gnunet-scheme] 22/49: examples/web: Make a non-functional web form for searching the DHT., gnunet, 2021/12/25
- [gnunet-scheme] 27/49: examples/web: Process DHT insertion forms., gnunet, 2021/12/25
- [gnunet-scheme] 40/49: examples/web: Don't hash the data.,
gnunet <=
- [gnunet-scheme] 35/49: examples/web: Allow module reloading., gnunet, 2021/12/25
- [gnunet-scheme] 23/49: examles/web: Add a non-functional form for DHT insertions., gnunet, 2021/12/25
- [gnunet-scheme] 15/49: Update copyright notices, gnunet, 2021/12/25
- [gnunet-scheme] 34/49: crypto: Implement functional variants., gnunet, 2021/12/25
- [gnunet-scheme] 33/49: examples/web: Hash free-form text first., gnunet, 2021/12/25
- [gnunet-scheme] 46/49: Merge branch 'dht'., gnunet, 2021/12/25
- [gnunet-scheme] 11/49: config: Define default UNIXPATH for DHT service., gnunet, 2021/12/25
- [gnunet-scheme] 16/49: Merge branch 'master' into dht, gnunet, 2021/12/25
- [gnunet-scheme] 19/49: dht/client: Recognise client result messages., gnunet, 2021/12/25
- [gnunet-scheme] 38/49: examples/web: Implement searching form., gnunet, 2021/12/25