Skip to content

Instantly share code, notes, and snippets.

@ysangkok
Created July 31, 2019 17:19
Show Gist options
  • Save ysangkok/de4790b09e90225297030641ae1c1088 to your computer and use it in GitHub Desktop.
Save ysangkok/de4790b09e90225297030641ae1c1088 to your computer and use it in GitHub Desktop.
(ns hello-test (:require [secp256k1.core :as secp256k1] [clojure.test :as test]))
(def rs-pub
(secp256k1/public-key "028d7500dd4c12685d1f568b4c2b5048e8534b873319f3a8daa612b469132ec7f7") )
(def ls-priv
(secp256k1/private-key (hello/fromhex "1111111111111111111111111111111111111111111111111111111111111111")))
(= (seq (.getEncoded (secp256k1/public-key ls-priv) true))
(seq (hello/fromhex "01034f355bdcb7cc0af728ef3cceb9615d90684bb5b2ca5f859ab0f0b704075871aa")))
(= (seq (hello/fromhex "01")) (seq (hello/fromhex "01")))
(test/with-test (defn compressPriv [x] (.getEncoded (secp256k1/public-key x) true) ) (test/testing "Keys"
(test/is (=
(seq (compressPriv ls-priv))
(seq (hello/fromhex "034f355bdcb7cc0af728ef3cceb9615d90684bb5b2ca5f859ab0f0b704075871aa" ))) )))
Test Summary
hello-test
Tested 1 namespaces
Ran 1 assertions, in 1 test functions
1 failures
Results
hello-test
1 non-passing tests:
Fail in compressPriv
Keys
expected: [3, 79, 53, 91, -36, -73, -52, 10, -9, 40, -17, 60, -50, -71, 97, 93,
-112, 104, 75, -75, -78, -54, 95, -123, -102, -80, -16, -73, 4, 7, 88,
113, -86]
actual: [3, 79, 53, 91, -36, -73, -52, 10, -9, 40, -17, 60, -50, -71, 97, 93,
-112, 104, 75, -75, -78, -54, 95, -123, -102, -80, -16, -73, 4, 7, 88,
113, -86]
diff: - nil
+ nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment