;; -*- Mode: Irken -*- (include "lib/basis.scm") (include "lib/map.scm") (include "lib/codecs/hex.scm") ;; from lib/crypto/sig.scm (define (xor-strings a b) (when (not (= (string-length a) (string-length b))) (raise (:SIG/XorStringUnequalLength a b))) (let ((r (make-string (string-length a)))) (for-range i (string-length a) (string-set! r i (int->char (logxor (char->int (string-ref a i)) (char->int (string-ref b i)))))) r)) (printf (string->hex (xor-strings (hex->string "1c0111001f010100061a024b53535009181c") (hex->string "686974207468652062756c6c277320657965"))) "\n") ;; => ;; "746865206b696420646f6e277420706c6179"