Raw-Transaction

將單詞解碼為事務十六進制的問題

  • December 9, 2020

我之前問過一個關於壓縮事務十六進制的問題,因為它用於涉及發送文本消息的項目(每條消息限制 160 個字元):

壓縮交易十六進製字元串

所以我使用了不同的方法,這裡是項目詳細資訊:https ://github.com/prayank23/OfflineTx

將事務十六進制轉換為單詞按預期工作。我在使用此處提到的 python 程式碼將單詞解碼為事務十六進制時遇到問題: https ://gist.github.com/grubles/41a8ab74afe2cee6ef7128b07438455b

嘗試解碼單詞時,它不會返回最後 4 個字元。

本例中使用的值:

發送十六進制:

02000000000101e939fb23e9991ebbc75fd08c736da32ca12d98a4ff1b8e970e97f5661927ee410100000000fdffffff02b0a90a000000000016001421e2f997b3bd36e273eaca365da8515a389444ae40420f0000000000160014829e2dbcf6b7f31bc93633971f71f6f6b9b5f89e0247304402200f8e3e573be749caf1964a85707bf540de2e7b367ae46c23bd4f21932ff82346022062dc3007072cd5a19b45e479525f4829bc48be4fd3c21b5a9ae34bcf9a3a3ccf0121020f88c7db36cbb492e80d3062fc19db55bed82687498f8cfe6d0cf47adf6687aa49f31b00

字:

answer frost position wrote message message actually calm energy iron dust valley music rock core blink regret frighten wife moonlight weave shove pride add mystery veil press gentle collapse aunt like like like skin tool patient dirt muscle holy like like like apple also also goodbye bone raise women along rainbow approach caught drag radio concern rose hate great yell worse forever stuck like like like alive bid tool shy flood truly house knock fade blow paint forest street stain mock never murder plant void history sentence rant often loose often utter book explain born point throughout hero gone worship closet canvas please sanctuary too although upon truly shimmer wow rather laugh simply twenty creation take garden innocent bench kiss companion reveal nine shall stolen angel dark candle dew anymore disguise darling happiness bound treat morning group weave stand grown ourselves rhyme bowl consider grace worse other torment like half law shower fruit reality dread third barely enough nail match rare manage tower honor ready

圖片

Grubles 分享了這不起作用的原因,我在此推文執行緒中解碼時遇到問題:https ://twitter.com/notgrubles/status/1336709747756724227

要求十六進制基本上可以被 8 整除。如果不是,編碼器將切斷其餘部分。因此,當您對單詞進行解碼時,您最終會得到與開始時或多或少相同的結果,但最後會失去一些字節。

基於 Joe Reuther 的腳本的新的和改進的十六進製到助記符編碼器/解碼器。主要用於偽裝比特幣資料(地址、PSBT 等)或在不使用 QR 的情況下在線上和離線電腦之間移動交易數據。

<https://gist.githubusercontent.com/grubles/69762512cd4e954722c03a0df1bc44ac/raw/b1a4d85dd70bfc972a6ab05a93d3432bf300d1b6/pgp-words-improved.py>

引用自:https://bitcoin.stackexchange.com/questions/99693