Skip to content

Commit

Permalink
Merge pull request #35 from jplomas/main
Browse files Browse the repository at this point in the history
Fix dilithium tests and qrllib-js build errors & add CI
  • Loading branch information
jplomas authored Jul 1, 2024
2 parents d9c8f93 + 9908d2e commit 2098b63
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 11 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Go

on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ '1.18', '1.19', '1.20', '1.21', '1.22.x' ]

steps:
- uses: actions/checkout@v4
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
# You can test your matrix by printing the current Go version
- name: Display Go version
run: go version
- name: Install dependencies
run: |
go get -v ./...
- name: Build
run: go build -v ./...
- name: Test with the Go CLI
run: go test -v ./... | sed ''/PASS/s//$(printf "\033[32mPASS\033[0m")/'' | sed ''/FAIL/s//$(printf "\033[31mFAIL\033[0m")/''
7 changes: 4 additions & 3 deletions dilithium/dilithium_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ package dilithium

import (
"encoding/hex"
"github.com/theQRL/go-qrllib/common"
"reflect"
"testing"

"github.com/theQRL/go-qrllib/common"
)

const (
PK1 = "da218daf9d5457bee0e2381250f7ad3159e8a243fbf90e02c2802e1722cee954758875aa00c57adda2736030ea7fd293367c202298d7125f4ca8bd83d0ee8e8805f4a9f2d3915d507a581d59a80491575ed69ed994a6650ecf8902cb056a6d5f8b59a46905ab1c58094c2a5a388de306486dbc23bf268ffa272e010182e8e9e23c07f55a866e59195333a353aeddf3cd51c22f955c21977d3ee9e4ee6557f30edb5d2517c04f834f6825a7a162323cb8b679cb5d2089190aa3e3c486b4b9895987b47e1b475ccc4f25969bc95ac24d2fb3cfcda7330ff9f949ac06a2b7a7293ee8463dc38a9c55d4bb5d8f4904836c29764931b0c3f4d1257871b132b08ae249fb40b61bb75360298f15345d4868b7aa4f06c485b703f6db84d2d5e1e70412928d6c6454a2a019540c518243e18e17404dfd781a576a34e0f297bc4fa69532e717cb9cadc1feafe4c6a99e31cde842dc05fd19d8c7131d530e9ab22b1c621e9d4a2ffd444376f0e0847c0523f56f345669fe88bb28492ed23dc822f83be85eb035695eceb08fb24fab3fb6cd54ee5972d68664af9d3bb4213da1ee11e95070eb45d033777eccf9efe54f2f23bdd0fd64cd0b4bd311d941f108fa13166505944de90e25fe50d4d4be8118d316994b53bacb96c92a4f4048e10fb01d7a8e89d7d0ba37f58ba37e1c399fd1d5c2fd0ba1d30231432a0592d0e06b0a18f0decaa3ef39e88c6d70b42bcc80e28f633c99a89e411d300ff78c7bc93f910906bc9d9202f4ce3b9a1c37432b4df23e053297f81b965ca0b1f447e323a2e66c9ffb75ab1c8daa2a9b239bd87bed1990f4dbf9747005950aa73b6a74da306342a63dfb67d5042f16814f08bd3fda8b572e501ce0a03111f93c0c1d3655634435f1ffc3fc000bf133c926bc336304eea648a7a1c7ebdd65fa593d5c11990878b385499a394584702fe309073aa15420e0d0980165ae7213dae40890babb2bbd3f7abf648c9dc74feba7c0ec8f0525bf5744744b9f5b28f6ac7f234e4f425f4bbafb69714abd911dd0514fd53039c13f72b1074f6c5a229f9172628747079193592bf74ac9049c2aed7823e9522ffeffb7d84887808a5e0814407ebbf514301fb015a3f0fa0c79d3fea883901f3bfc493569a239156f29364a1b43aeb4c3dc6a975ba517e1a6e8ca66b60e4de5326d2d65d95783b050546c73edc37175bf2dac38109c4cc6711c4f6ce4b7af5313e1967161841c11cbbd4f998d5d6b6b1135c9c75616ec88393300c199a2d602f6b048302258c6bf8960434ba6d3d6108a9d8fe17569c1454aedaa7b383975f3ecf1565df1e007744b9474111756a9b4471475dac9e55bb5eb1df67329aa077c14bb8aebac457ad06744e6b67238e1416e14a1c8c84d7981bb42b41562b10b9ba86809f47d19bb2c6a8a9f88559a9a73fecc7f95d781501095fd0f7493ecb020b35b613e2c91db655a9c85ae893e4da69e1ad833fb40c285f09992dbb6b18f154b198af34e3088928102e618722412934ff0bff977d9195d3eb520f8edb7cb08ffc9eeb0f60d02d8272652e456fdd28392acb41ce12fadc83c70dd742abd2015805f2b3713995d1d99050f08f9f88366cf5870b827dadc5bd20fdeacd672df857330be4e1b96838a0d8e97859fd7127d355e51ff9a5e43697b3cedaa1d62dd3aabe28fef97eae5cfec98399bc66f7a34616f95dcebf7eb6563a9115c13c46a80d564e669af08ce600ba0fec9f15a9422b1da6c3995cbff0212626c118ddf77721d84c938200bc9618e7234e3137053eb16620942e9632684e73163f0daad57327999e800c226a09c7083581e3b647cbd61e42a986ecb52f8e64e4d3efdb3fb942ebf2d1638a5c567115e6d33436e2f515e15b903e727d22c1945c968fd1ba1d87093e7768b75cd6033f2826580e85bd7c96477a62b1956a8f7aaba88d7ae095812acc9b9c33a477f3f920e49c7443bba90561b7804f6fe2bba598103507c61365bc11aea34f9f84c0e3a902eb6df4c292aead67699a63c1f5a4b87beb14b2e45537841902764b459b90ba378aadfdcd125deb953413fec2e3e1e3b4f6e435ae84cc7951b996a03db7e49cd1ddeda2041c99eff5dc9c85ffa383852ba9f9dde80cfe8c0353a6faa24a5ae307b8bd863c14f6a9b5b75daf8534118131b3b32b8239f51f6d5123ced24e9bd251d208ca40fa97f9e47fa79f25ede38280a5206c10281a8d4a8459fb0fe9dece2cc61f1ced84e7b5744e59312e32de10c82be7f81264d3a775a04913ce7bb1f28c25037f4b3b2ad5790b3667c9e309234cd161c36f7a71a0145ff0a7c9c1b9bed601b4971696c1979ac3ae2418a842e50c33ed45fddd0e319e48f72583cb90a4b08a57983f63918352cbc6f0a6d345c845f0f2cfbebc25cef454dfcdde04966e63e37d0b2060a12bdedfe3758c5f38a3c7250271ce9dded0e2c37304bbf668add831f76902d42041b9e7a2d77e9e912980be070a0dd84f3523055a86d84b7d92282974ec8f411e26aa88286b6a1314ea9a0b3d3ab100947770238d6a714d0e2ac9a1b7b3cff7e54c33d8bf7a40972418dc7fb205d7c29a8ad0a269eb9f0874e1ae2d37485e9fac92bce8c267d2feaa63f1fe186ae0cd25b626246b2db984941fa6eeb2b2ab14a56aaf15da2458b591b4862173a917a404725b9fee25539b948b2e2c9c5f2a251e9f88cd301715aa221e710228a0e1c691e0ea91414d7ddc6cbe76b572dd904b8107e4472e5e0d694ec8e4cf29c79ca83206c9a8fcb8e77a1157b4f7c9a68ab41520b5e2c0c9af6d11109c259ab5dc8d1f87bc83ebeb4a8845519833e42883ad7b16752b2ffbdc53ececca688b97b431a33d4223dcc32be985ea66f255ae44df027713ae10120e3bcc2eac966d974cc6e69449e959d7eb783855f975d36a8a5d5889db3137b338cabba16284d87965493bb07cc5639bb017499d5a59049a65fd5a0a58568c8c93677491b45b3099dd3ab9527dcb9455d42e7c22278dd800187a8fa016ad0ae3a5737f5ac6fbec043576cf5298150daba87066fb20ee074dfbfb330f4d9321834b35b43e9448997b254e78e1f2c5a4d757e4dc5bfee53dedcc863c539273d7135b063b724bc0edf153fd1f2828866801673c068442b38bcf45ea3bc006b84aaef5e8cc1de1d00e10484b3a59546c4b729595bde6a7facb5e1f6a041dd52307ec9ca2d1ca891eca2e2f0803ddac1698d6cc07d4ee381c06e9d232676c1acfa03287000c44afdf6c1613fa3ae499acd852f8a43dee5f2f790ab6b56a3010d6f35b6d0d3d185540f21593b8d8e75c4938192706ae087555ebc1e48882f1ee46af8256964d7fd4fb9bb6ffa60f79036b17e46d7f210c25fb1690a748dcf33ae74b1f44290fe1a46b87333def13630cc17e7e1290593775b043f817e603675dd16ceb159b4ee6d43799c2ae23984465e0942a64e30da1271d5e6194585d3ecdfe2302d4cae4ca388a516184e333f0d87103ab6585a955be8c7708c338fe1775b04486721b008cf99fd1f6d1a0d1027d975b21086fd42d4037f7979eac9e22108432401aff3443c5aec62e5a7c44bcda3d0ccc0e1b56c611f69b84500d2649f852190eedd1eb9a121d476dd26f81c6a52859c1de36066e8ce44a9f2edf94717b0fe445caddb"
SK1 = "da218daf9d5457bee0e2381250f7ad3159e8a243fbf90e02c2802e1722cee9540b5e62cb0091be3c87a916e8f74d930b2e2d855068b043512edb1227b8727e035741cda59a36b5b2a7f520f05f99d76d9a34cdd2694c4dc703930a6fbbc1d402821440e3804d918065543042a0084ed8146e03895181266c0907092434509230899110908a2620092226a2185003809001002800294c5a9884120589dc0288d40269423460c3a0801ac9444bc60c5b14514bc400ca804523842de326851ab02d4408698b0601a2b68122c98c09b604609865102310e1060650b42d0c174e1c970d63008158402ae0484e03a86dcc18729b2621e0a408d2a630dc20251ab80518c1689002929c46061c808c5c4444a3842418b60104c0094122129992008084252085610215041c8870dc32061cb460e11829cca60001012652226acc1640d0221014a74d1246881c30201b4520143552c31412cc88459340100b0082448288dc042d4c380820173024a07183a6851a435009926082a40882a6858930012220069ab6705c44421401891c3565008244c922100cb52c88040294384a14238e5c929119867140888422054ed332680320421b4826d3280123468da31669e41206c2027104078cc9b2298ac62408364854a4600a470ae0c0000a058e0c43409136645c189108b77040c248d8886148a860130110d440484a3402c1a608d9001100838418254e90940103383062a8290a074019932521171013446048806c0104014bb490e4806004434e14896c913231cb146123478298b88c2406510c952908a881133428a00848224029e0440058b690082588220024923228e308520846101b84050a1745903422e0821119384ae2265259182244280ea3968492448e21116d21168512906c091025d010921ca491122932002844191311cc342450308894142098468c1036524820811b224e0035480bc98583b80d230224cb922c61346a628884e4b49008890019b02960b02d1a32111ba0514496900291094b96299b9670d40480d1122ae0a8040a220243a88484426a001990a49049211129c8885109232c94040d20b62dc0b811cba0490840520033851239489340454216701b1811042380d33089dbc82401380984386621488dc38001e30844091401540672c3863123214cd8c62c9b2642042340933864c1446a0c22241aa824cc007204a969e0902ddb060ec286911204850a131284c00c649851592845db28820c982120c429602002da240e62288e600284648848e41086cb929009448d88126d4904285a24264a3665db309019110250181183824183b03063a669c3a084d80884e39870491200099745e2c02182202a63c400e018851828915b288408c189922472a1202883126589c464cb962d113072e1308ed816420883441882889c104954124a09042404142da49021481044c24604a0c86401a54d82486503c8851c95454c34916026514394891a136c0b06895ac44121398590a48d834609230425d3149142088002b62004324d00a34889162e903068c0345224c0684b1252e108214c422cda386a22134600008cd1386cca90919aa88820450a94a24121268918354e88929120004412866d8118661144668aa891098864093051192288483066114271e1220018b77020876cda4832c926621c1770928451a1408d64048d103880000282c8c4688ca268a2c82821a36911c3095cc0500a99600a08620c36101b47319a3266e1c00d029889c9246c08c6300c108c2208040b37811b27015a02215bb0010a36314c8885c9a48d11a08c8a862124b5042221010c872904094851a60509106acc448a21c391e2b46414c3115ab60862c0641a28824ab081d82262a316082424461c8328198428c2066e03432c20196e0bb765c8a031a316029b14058a228ec34252c2b00561a2491c144441161294242089b49100a86d480262591061d4c044a1a265c4344e11038190322a59a2842240618c4440a09849d1964d44266062088920920c0a1812520866c22470049230242886cc98205b26444b202c18b2619c086a98428c8ac020a49410e292290a09322080701c2522a22632122892d3342e14828903068d1ca45083344880322908336a1ca941c11065c800518928105c042a0b856991e93f35659d3f7b11bbfc3443dd48cb0e3cdc35be09f092124908b0344c0fd5d1595ff2bd9473f854280d2bcd9377d6129f3f105f16d80899dd16d5c452bc002b14cc5304b98099f4f189dc344f3d77bff6e0aa03511969012ec0e857a3d8ab31cf08ed1a48be59bb0f9b2bf9a8a4d4c6a35d45fefd45b7c7f792db793d236f52605ed7a80dd4e8e9696a44c7d5232bbad92c80b54afc61ded07a01645ba70e8f6181d6ad479d2e0db5fc59a46b251243422d03d2048fd1c1cb55c70b03dd55eacb3d96a91ea2941d1aa01ab1552b8b22caa17a83e4bd740b1e998526eabf5bacaf31a0d088c1d0419bd666f4b468c408ef8bad59e61d47d235f1ff7369701a849c59ba9cb79699a66d03c67d650552f5d4bab6e09ad17a4dc5190eeba879ce2d104c34f183119802154b146057e44942af4a107017d9fc057bab642e920a3596cc500fe2e71009a1b6b51c0e55eab2c08ed2c1e05a28046b0024a7e64f7307c1927960fe6dc275db066f617b6c33d6dd295c300e8421563b040921306db9eec5d92a8f426d9d02a9afc4ca4b6b81f28a70af6a06ac275218235395d40310b9b1190171ae17ebfe24127d3761874e5c49817e763b251a07d1dfa3d15d7ec26b52f695cc8023a74cd418c579952a9e0a59cd4712a2171e63027c43def6a3627b154d43177ee2a9f9e63886764c98c0b0705156daf132e41a458cfdf836cfcaf5ed0c6bda497eaffca3b50e83791811d10985e89bf0bafb9b24a94dbdc65a895791eae3a72a6e6ced4799dcedde9e136060fc6a2da86f4d91106847003e621d3f51fdfbda193e44162c3369cf6bc4a0db9cffe70d1fc4b4735fb975c0c1dd200128d9942a03d946570036f2513b9d4745c2a0a0a76b66485528be114a77c146c69f8ae352557ea80518a00e49a153a12bbed470d921dbaf89748f23f9b84ae2e91c705a3a47f70a11420e7d68cbb412fa046f9021ab7f34cab78bc4ab6ce1f88f1791185cd74803ccaec6098406fb3e6b9b4ef390d1e2523cca02c6fe5e71adcd52f65e0e384fff1a404ad09b9b9d9b74e669000440ef5a54dded018fa838ebf075cd3201d225c178a56a2efa5f6438f0a9c0e8e9adca7980943e8824e191f862ec5c3bd7659b3a13978d6ca6ee41440797d451cf6c2c25ff7a6f52bddc35da446b0fc05cc6f664361a5f3feb4509aeb500f6811c6582fc428c4741bde88ae91ccab1eab7e1a18ea7a10b393ea9d84b26621e8b23dd86aa899b408cf3a3dee902d697b91314d8c1ec14319cf9fff43a63b4e832feaaba33363dce8c8a3534b843f4c47a42f29bf275f152a9c0400fa0efa666bc4edee127c0684958b3e050428cd8d4397be14540267916b36ec1325b352a7657693f16219eaf7d0ec05d925c8e5c563f935c16aea2e843ac24c395ecd6e35ce8a8ea61f866d1f2562254a1d782a27ed46ca258b0f7de78a2ed0d5391c5cc35954da52ca7bb85d4dc0bb5d894a7aeda4dc8a0683e49d80fe9831b975871fc19d1fe0394ade47f7d2982a316d08c29cee8a3add11367503ab528fac173987ec411553359f83b61e9659133c7f27471934556ea5d3574b814d811907f9dd25d9b2c3f1ad2aba5ab2cbf7417cd7a41cf249a5205063c52fcc20badfacb9e3202a78edb047709d56448058cd6515f8c0f08e5073a62eca1961f1bdcbb335ab6c333df3ca765f45c5ee5e8717e32626bde1c2bdc40633832efc2eb3ee52bd552a3a1c242da37f55f171766a2f36caa6a8a8c227677bc159a40207bea82f03bbf4a8b9563e94d5506f1a25346c2de761451cbaa2527ad4fa182f11baf7ff9bf5096498dd25587a245e097dd837593a7a2636ac878d136781c265983bbf0740320e98edfb312448bea66b38e087edf2ae13a8bca6798fb94abbdb36360567ab84332ab6ff2b77d9383f6c117d525ba7f3d31a79e101e15fb5a24f243ba7ebebfdcbc27ccb567a3125506f9f6e3254218068d892bbc11d1dc8c23bd5995329f829d02bc1bcff3f934e2104f91eb98b7d0830bfc8399f0992f7aafd0ad2ad1fb472d946406381320412260f90fd6dbb851022330d86cc3c8caa27f70f46e2335cc8775cd028c8d08a3956b44211be8cab10447f7dc7a981370e9d623a03f892ebd7f82a6562facd3a535197f92174328148d5cad8e2ce990167c22e4099b1843a0efeeddc47a190cf991d9d1a8f46a9b9d442a7bfb6c95ce5628626495dda99f1ca937e74f8dd504e6274ee0351157c64ebfb6e072338402aae2cac125cc6938bf1d1b43a04845c64fe8bba7ea16c3273616f0a1666254abfa1c6a47cab4fa53230369d92e301e80e32ef528e9e707202ee034de448a74592834f76ff0429d7bd600f3eea2dcce06e4d10d09eaffa1ed21ec0d2504308d12fa025761794675bd5d75dd7838bbebf974bee0424e968a8b25cf84770660107a0e217e0ecfb97312a04852f68029be7148b3fd42039deb52af700d737df731140832eafdfdc219a4193f804cb2d282807b52d8b2ce05ffeb81861b7433ea643413b4c50ca7858824e00b0ab87d22e9f1e8ee84948fb4443f85d7376859cc20ff2e5a6e9acf11002b868acd3e6464199950ba254093c83983a5aeebd1490a375785a2abb0372f7c9f27b7f66d28cc0c8fc3019f87106f7ff9ddf6d66e3e4ffa872ad4c59837b5837f13e13fdbe1d99612c6a0e016a8567777611a28f694906a0f4c01615fb3ce99788fb529fbf7dc7bd0afefb4c6281ca9af635e7271d9a2c0a77c108b292a05d805ab7b557c77329937a7794eaeb5fd23164decfe33d2a7edd1c00998f168e3a33c8d59dc1bf311ce3a7874e9a1177639dcabd8c98591402fe14e0d29a4b74018b5d7e1498262d6877913df8990e88ada6352a3671d94d54298bdde3ca8992a76113c321812c2526de321c55ae2bb6f7c42868a106a9266dacb4aae9ea925500e876b6f061ea76161d464f88d208c4843aaed1934539c593e0e7318f92f34a9b4d6636e79086f13c5b298004f9077e71b8e159592867d0cd474bdefc595806e6715be347ceaf4a05b8213fae23677f46f697f076a07080f066c6efd5cbd381d5c414fa0225785e50157ffbe93f404458738d33b29f8f798444ba95d0f23e5533bf9097beea2fa4da6fcee69c1b7047327533b46dbdc2622d008f02cf46a2c7368d0ecb1efddfd31e8d3e4f06a420afbe309675c27a8a9d3c47c4ec7827909f770d257b80bcd65db5476282bc1cf555cd0c03905f6f7d6fef2c300d465f20601e96db6b21fc11cec51786a5d0540cad5f94fe6770a4858abd7522effcd0ad1578a9289dfb51427b404eaad1dba801fb3f9da7a5fe86d1f4bb586b8a07ec89b1995d74275dcafca5cfba11492fd1843fa46661645c76fefed8b804981931619c82bef217c70713cc3e21ef97ead5fafe951bbd15d0d91ba81b49bb82cf0acef3b3d6c9a9b00c01d8fccbd253e71baec8d272193846e4be0520bba660582dde0954847e97d8f747d24ef50551c1b4346826f0739be9cb1547600b09e170149ff67536bc55f96abdcd8ec2491d0f8d9154e8431cf6c06855e09ce311582eb78271e4854e0c5b98c9faaded452d7a55b94803cb6a8d5b571f7e6e118312f6d9cdd2bb09d1930e0a1b608a06c7ad5a0bda41c6ddbeac54421c8a4383b7f684bb0c74faedddb6100c1a9b3b19a5645d46e6570da70135c383f19acb7f56b25c2bbfc23a0f00739598d0c00b1edb912275fab346e1ef99ed61201851a5cbb062f3836b26852612ad38dd855911835b73f79ca991727e2589935c98f24d14ca59f1317de7938e4eade460e9bbf51bf5bf26d148bc4b6ad709aff2f63adf93acf77e84b1eca57b748ad0f2952eb99efec9a9536539b880f8140103a1b360a95767652a27787e9e8f9cf8c3e2b7912c7ff9dc772b3e3b3919bf30cf8d626e7fa3d1986bf364fccfac98b337437dcdd6841339a71a6b1ddfd5c5cd59e6ed3848bcdcce7a63cf4df936aa39be758b7c98b36724a012010ef2d3b71a34007494b83eefa94bd26e7d21e6b6378a56dd0dfb6837f20acee1965723db0490a3ac55375d45fcfe119d9ec4a55a507f145189ec3ba2b4181dfcda83d7bef3100dd826f1d89df0391a65f4a79f18fa6c75de83502de768499473e8ba908239e17e31da44fa5679b7a82305c0d5de676cb1242029575613358ce7c723feea343c8888275c018819dd10411243e9f8dd271fd3a9772a3ce1b2fd4c39e4522c8f692a25aaa7da5b05c5fd790ba6a2fa1d154d7bee699d57663990cddfc950c4b713f50a6ac8e7849678caffbf5c90be00d984097358e68d2e32838f7e8e66ab2257616777f080abd5db88a4ecc945a5ab3e5e4c28a49dfa4a8a0e771d15b3551d6fc41ea0e0536d2f590010fecfb25be4110054037073a3efffc749c7af845d85ccab8babd4a0b539907e1624ed69e7cf1fb9456d3b1c4a4be57727e02206cca30ad7cb62801912c147d600e9b48954d9cd2402fbccc4719da7ae98cccfc0b8e2e31bdc7a0fb5b43e63572835bf0f9d1d2da954e4716a70d147dfdcf61241e6831c5b99854e970bf692a2429b9c977c6f5247bd0ee175a2b53d6ce2aa0320291353ee3092507f1f4757c37489d845ad922562f4111dcd680c58ed4a6eb77957daa96dfdc95077815e4ad40ee130768222c9ba6df0c9f5ea3693994061040e9"
HexSeed = "f29f58aff0b00de2844f7e20bd9eeaacc379150043beeb328335817512b29fbb7184da84a092f842b2a06d72a24a5d28"
Address = "2099d76d9a34cdd2694c4dc703930a6fbbc1d402"
Address = "1099d76d9a34cdd2694c4dc703930a6fbbc1d402"
Mnemonic = "veto waiter rail aroma aunt chess fiend than sahara unwary punk dawn belong agent sane reefy loyal from judas clean paste rho madam poor pay convoy duty circa hybrid circus exempt splash"
)

Expand Down Expand Up @@ -434,7 +435,7 @@ func TestExtractSignature(t *testing.T) {
func TestGetDilithiumAddressFromPK(t *testing.T) {
pk := PKHStrToBin(PK1)

expectedAddress := "2099d76d9a34cdd2694c4dc703930a6fbbc1d402"
expectedAddress := "1099d76d9a34cdd2694c4dc703930a6fbbc1d402"
addressBin := GetDilithiumAddressFromPK(pk)
address := hex.EncodeToString(addressBin[:])

Expand Down
18 changes: 11 additions & 7 deletions qrllib-js/dilithiumjs/dilithium.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package dilithiumjs

import (
"encoding/hex"
"strings"

"github.com/gopherjs/gopherjs/js"
"github.com/theQRL/go-qrllib/common"
"github.com/theQRL/go-qrllib/dilithium"
"strings"
)

type DilithiumJS struct {
Expand Down Expand Up @@ -38,7 +39,7 @@ func newDilithiumJS(d *dilithium.Dilithium) *js.Object {
}

func NewDilithiumJS() *js.Object {
d := dilithium.New()
d, _ := dilithium.New()
return newDilithiumJS(d)
}

Expand All @@ -50,7 +51,7 @@ func NewDilithiumJSFromSeed(seed string) *js.Object {
}
var sizedBinSeed [common.SeedSize]uint8
copy(sizedBinSeed[:], binSeed)
d := dilithium.NewDilithiumFromSeed(sizedBinSeed)
d, _ := dilithium.NewDilithiumFromSeed(sizedBinSeed)

return newDilithiumJS(d)
}
Expand All @@ -73,7 +74,7 @@ func (d *DilithiumJS) GetAddress() string {
}

func (d *DilithiumJS) Sign(message []uint8) string {
binSignature := d.d.Sign(message)
binSignature, _ := d.d.Sign(message)
return "0x" + hex.EncodeToString(binSignature[:])
}

Expand All @@ -90,10 +91,13 @@ func DilithiumVerify(message []uint8, signature string, pk string) bool {
return false
}

var sizedBinPK [dilithium.PKSizePacked]uint8
var sizedBinPK [dilithium.CryptoPublicKeyBytes]uint8
copy(sizedBinPK[:], binPK)

return dilithium.Verify(message, binSignature, &sizedBinPK)
var sizedBinSignature [dilithium.CryptoBytes]uint8
copy(sizedBinSignature[:], binSignature)

return dilithium.Verify(message, sizedBinSignature, &sizedBinPK)
}

func GetDilithiumAddressFromPK(pk string) string {
Expand All @@ -103,7 +107,7 @@ func GetDilithiumAddressFromPK(pk string) string {
return ""
}

var sizedBinPK [dilithium.PKSizePacked]uint8
var sizedBinPK [dilithium.CryptoPublicKeyBytes]uint8
copy(sizedBinPK[:], binPK)

binAddress := dilithium.GetDilithiumAddressFromPK(sizedBinPK)
Expand Down
2 changes: 1 addition & 1 deletion xmss/xmss_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func TestIsValidLegacyXMSSAddress(t *testing.T) {
}

func TestIsValidXMSSAddress2(t *testing.T) {
addr, _ := hex.DecodeString("2001430a5152fcc369c309caf3554bd3528161c8")
addr, _ := hex.DecodeString("1001430a5152fcc369c309caf3554bd3528161c8")
var address [20]uint8
copy(address[:], addr)
if IsValidXMSSAddress(address) {
Expand Down

0 comments on commit 2098b63

Please sign in to comment.