Python十六进制转换
Python Hexadecimal convertor
我有以下十六进制字符串
hex = '0E656F73696F3A3A6162692F312E310017036261670003076163636F756E74046E616D65056974656D730875696E7436345B5D066C6F636B656404626F6F6C0A636C61696D5F6974656D0002056D696E6572046E616D650C74656D706C6174655F6964730875696E7433325B5D09636C61696D6E6674730001056D696E6572046E616D6509636C6561726261677300000B636C6561726D696E65727300000C636F6E74725F676C6F62616C00031064656C61795F6D756C7469706C6965720675696E7431360F6C75636B5F6D756C7469706C6965720675696E7431360F656173655F6D756C7469706C6965720675696E7431360B636F6E74725F737461746500040E6C6173745F66696C6C5F74696D650A74696D655F706F696E740966696C6C5F7261746507666C6F617436340C6275636B65745F746F74616C0561737365740B6D696E655F6275636B6574056173736574076465706F7369740002076163636F756E74046E616D65087175616E746974790561737365740466696C6C0002076163636F756E74046E616D650B706C616E65745F6E616D65046E616D65076C6F676D696E650003056D696E6572046E616D6506706172616D730B6D696E696E675F6461746106626F756E7479056173736574046D696E650002056D696E6572046E616D65056E6F6E6365056279746573056D696E65720004056D696E6572046E616D650C6C6173745F6D696E655F74780B636865636B73756D323536096C6173745F6D696E650E74696D655F706F696E745F7365630C63757272656E745F6C616E640675696E7436340B6D696E696E675F64617461000707696E76616C69640575696E7438056572726F7206737472696E670564656C61790675696E7431360A646966666963756C74790575696E743804656173650575696E7438046C75636B0575696E74380A636F6D6D697373696F6E0675696E7431360E6D696E696E676E66745F6974656D000206726172697479046E616D650C74656D706C6174655F6964730875696E7433325B5D0870726F6372616E6400000572616E646F00020269640675696E743634076163636F756E74046E616D650B7265636569766572616E640002086173736F635F69640675696E7436340C72616E646F6D5F76616C75650B636865636B73756D3235360A7265736574737461746500010B706C616E65745F6E616D65046E616D65067365746261670002076163636F756E74046E616D65056974656D730875696E7436345B5D077365746C616E640002076163636F756E74046E616D65076C616E645F69640675696E7436340B7365746C616E646E69636B0003076163636F756E74046E616D65076C616E645F69640675696E743634086E69636B6E616D6506737472696E67077365746E667473000206726172697479046E616D650C74656D706C6174655F6964730875696E7433325B5D0C73657470726F6669747368720003076163636F756E74046E616D65076C616E645F69640675696E7436340C70726F6669745F73686172650675696E7431360E0000C0794DE94C4409636C61696D6E667473000000C0CC9C6B544409636C656172626167730000F055D3C96B54440B636C6561726D696E65727300000000000010A35B0466696C6C00000000404D27198D076C6F676D696E65000000000000A0A693046D696E6500000000699A8BE8AD0870726F6372616E640000D234576DA790BA0B7265636569766572616E64000080CA26E3ACB0BA0A7265736574737461746500000000003073B2C20673657462616700000000204D13B3C2077365746C616E6400002072334D13B3C20B7365746C616E646E69636B0000000000E735B3C2077365746E66747300701BCE6ED15BB3C20C73657470726F66697473687200080000000000809939036936340000036261670000000060E94C440369363400000A636C61696D5F6974656D000000383B4CAB4A036936340000076465706F73697400000000447368640369363400000C636F6E74725F676C6F62616C00000000E0ABA693036936340000056D696E65720000CE6BB2E9A6930369363400000E6D696E696E676E66745F6974656D00000000609AA6B90369363400000572616E646F000000000C954DC60369363400000B636F6E74725F737461746500000000'
我即将使用
完全转换
bytes.fromhex(hex)
我得到以下信息:
b"\x0eeosio::abi/1.1\x00\x17\x03bag\x00\x03\x07account\x04name\x05items\x08uint64[]\x06locked\x04bool\nclaim_item\x00\x02\x05miner\x04name\x0ctemplate_ids\x08uint32[]\tclaimnfts\x00\x01\x05miner\x04name\tclearbags\x00\x00\x0bclearminers\x00\x00\x0ccontr_global\x00\x03\x10delay_multiplier\x06uint16\x0fluck_multiplier\x06uint16\x0fease_multiplier\x06uint16\x0bcontr_state\x00\x04\x0elast_fill_time\ntime_point\tfill_rate\x07float64\x0cbucket_total\x05asset\x0bmine_bucket\x05asset\x07deposit\x00\x02\x07account\x04name\x08quantity\x05asset\x04fill\x00\x02\x07account\x04name\x0bplanet_name\x04name\x07logmine\x00\x03\x05miner\x04name\x06params\x0bmining_data\x06bounty\x05asset\x04mine\x00\x02\x05miner\x04name\x05nonce\x05bytes\x05miner\x00\x04\x05miner\x04name\x0clast_mine_tx\x0bchecksum256\tlast_mine\x0etime_point_sec\x0ccurrent_land\x06uint64\x0bmining_data\x00\x07\x07invalid\x05uint8\x05error\x06string\x05delay\x06uint16\ndifficulty\x05uint8\x04ease\x05uint8\x04luck\x05uint8\ncommission\x06uint16\x0eminingnft_item\x00\x02\x06rarity\x04name\x0ctemplate_ids\x08uint32[]\x08procrand\x00\x00\x05rando\x00\x02\x02id\x06uint64\x07account\x04name\x0breceiverand\x00\x02\x08assoc_id\x06uint64\x0crandom_value\x0bchecksum256\nresetstate\x00\x01\x0bplanet_name\x04name\x06setbag\x00\x02\x07account\x04name\x05items\x08uint64[]\x07setland\x00\x02\x07account\x04name\x07land_id\x06uint64\x0bsetlandnick\x00\x03\x07account\x04name\x07land_id\x06uint64\x08nickname\x06string\x07setnfts\x00\x02\x06rarity\x04name\x0ctemplate_ids\x08uint32[]\x0csetprofitshr\x00\x03\x07account\x04name\x07land_id\x06uint64\x0cprofit_share\x06uint16\x0e\x00\x00\xc0yM\xe9LD\tclaimnfts\x00\x00\x00\xc0\xcc\x9ckTD\tclearbags\x00\x00\xf0U\xd3\xc9kTD\x0bclearminers\x00\x00\x00\x00\x00\x00\x10\xa3[\x04fill\x00\x00\x00\x00@M'\x19\x8d\x07logmine\x00\x00\x00\x00\x00\x00\xa0\xa6\x93\x04mine\x00\x00\x00\x00i\x9a\x8b\xe8\xad\x08procrand\x00\x00\xd24Wm\xa7\x90\xba\x0breceiverand\x00\x00\x80\xca&\xe3\xac\xb0\xba\nresetstate\x00\x00\x00\x00\x000s\xb2\xc2\x06setbag\x00\x00\x00\x00 M\x13\xb3\xc2\x07setland\x00\x00 r3M\x13\xb3\xc2\x0bsetlandnick\x00\x00\x00\x00\x00\xe75\xb3\xc2\x07setnfts\x00p\x1b\xcen\xd1[\xb3\xc2\x0csetprofitshr\x00\x08\x00\x00\x00\x00\x00\x80\x999\x03i64\x00\x00\x03bag\x00\x00\x00\x00`\xe9LD\x03i64\x00\x00\nclaim_item\x00\x00\x008;L\xabJ\x03i64\x00\x00\x07deposit\x00\x00\x00\x00Dshd\x03i64\x00\x00\x0ccontr_global\x00\x00\x00\x00\xe0\xab\xa6\x93\x03i64\x00\x00\x05miner\x00\x00\xcek\xb2\xe9\xa6\x93\x03i64\x00\x00\x0eminingnft_item\x00\x00\x00\x00`\x9a\xa6\xb9\x03i64\x00\x00\x05rando\x00\x00\x00\x00\x0c\x95M\xc6\x03i64\x00\x00\x0bcontr_state\x00\x00\x00\x00"
我显然漏掉了解码的一个步骤,如果我将数据插入这个网站,https://string-functions.com/hex-string.aspx
我得到了更易读的东西,尽管并不完美
eosio::abi/1.1bagaccountnameitemsuint64[]lockedbool
claim_itemminernametemplate_idsuint32[] claimnftsminername clearbagsclearminerscontr_globaldelay_multiplieruint16luck_multiplieruint16ease_multiplieruint16contr_statelast_fill_time
time_point fill_ratefloat64bucket_totalassetmine_bucketassetdepositaccountnamequantityassetfillaccountnameplanet_namenamelogmineminernameparamsmining_databountyassetmineminernamenoncebytesminerminernamelast_mine_txchecksum256 last_minetime_point_seccurrent_landuint64mining_datainvaliduint8errorstringdelayuint16
difficultyuint8easeuint8luckuint8
commissionuint16miningnft_itemraritynametemplate_idsuint32[]procrandrandoiduint64accountnamereceiverandassoc_iduint64random_valuechecksum256
resetstateplanet_namenamesetbagaccountnameitemsuint64[]setlandaccountnameland_iduint64setlandnickaccountnameland_iduint64nicknamestringsetnftsraritynametemplate_idsuint32[]setprofitshraccountnameland_iduint64profit_shareuint16ÀyMéLD claimnftsÀÌœkTD clearbagsðUÓÉkTDclearminers£[fill@M'logmine ¦“mineiš‹èprocrandÒ4Wm§ºreceiverand€Ê&㬰º
resetstate0s²Âsetbag M³Âsetland r3M³Âsetlandnickç5³ÂsetnftspÎnÑ[³Âsetprofitshr€™9i64bag`éLDi64
claim_item8;L«Ji64depositDshdi64contr_global૦“i64minerÎk²é¦“i64miningnft_item`š¦¹i64rando•MÆi64contr_state
你可以这样做:
hex = '0E656F73696F3A3A6162692F312E310017036261670003076163636F756E74046E616D65056974656D730875696E7436345B5D066C6F636B656404626F6F6C0A636C61696D5F6974656D0002056D696E6572046E616D650C74656D706C6174655F6964730875696E7433325B5D09636C61696D6E6674730001056D696E6572046E616D6509636C6561726261677300000B636C6561726D696E65727300000C636F6E74725F676C6F62616C00031064656C61795F6D756C7469706C6965720675696E7431360F6C75636B5F6D756C7469706C6965720675696E7431360F656173655F6D756C7469706C6965720675696E7431360B636F6E74725F737461746500040E6C6173745F66696C6C5F74696D650A74696D655F706F696E740966696C6C5F7261746507666C6F617436340C6275636B65745F746F74616C0561737365740B6D696E655F6275636B6574056173736574076465706F7369740002076163636F756E74046E616D65087175616E746974790561737365740466696C6C0002076163636F756E74046E616D650B706C616E65745F6E616D65046E616D65076C6F676D696E650003056D696E6572046E616D6506706172616D730B6D696E696E675F6461746106626F756E7479056173736574046D696E650002056D696E6572046E616D65056E6F6E6365056279746573056D696E65720004056D696E6572046E616D650C6C6173745F6D696E655F74780B636865636B73756D323536096C6173745F6D696E650E74696D655F706F696E745F7365630C63757272656E745F6C616E640675696E7436340B6D696E696E675F64617461000707696E76616C69640575696E7438056572726F7206737472696E670564656C61790675696E7431360A646966666963756C74790575696E743804656173650575696E7438046C75636B0575696E74380A636F6D6D697373696F6E0675696E7431360E6D696E696E676E66745F6974656D000206726172697479046E616D650C74656D706C6174655F6964730875696E7433325B5D0870726F6372616E6400000572616E646F00020269640675696E743634076163636F756E74046E616D650B7265636569766572616E640002086173736F635F69640675696E7436340C72616E646F6D5F76616C75650B636865636B73756D3235360A7265736574737461746500010B706C616E65745F6E616D65046E616D65067365746261670002076163636F756E74046E616D65056974656D730875696E7436345B5D077365746C616E640002076163636F756E74046E616D65076C616E645F69640675696E7436340B7365746C616E646E69636B0003076163636F756E74046E616D65076C616E645F69640675696E743634086E69636B6E616D6506737472696E67077365746E667473000206726172697479046E616D650C74656D706C6174655F6964730875696E7433325B5D0C73657470726F6669747368720003076163636F756E74046E616D65076C616E645F69640675696E7436340C70726F6669745F73686172650675696E7431360E0000C0794DE94C4409636C61696D6E667473000000C0CC9C6B544409636C656172626167730000F055D3C96B54440B636C6561726D696E65727300000000000010A35B0466696C6C00000000404D27198D076C6F676D696E65000000000000A0A693046D696E6500000000699A8BE8AD0870726F6372616E640000D234576DA790BA0B7265636569766572616E64000080CA26E3ACB0BA0A7265736574737461746500000000003073B2C20673657462616700000000204D13B3C2077365746C616E6400002072334D13B3C20B7365746C616E646E69636B0000000000E735B3C2077365746E66747300701BCE6ED15BB3C20C73657470726F66697473687200080000000000809939036936340000036261670000000060E94C440369363400000A636C61696D5F6974656D000000383B4CAB4A036936340000076465706F73697400000000447368640369363400000C636F6E74725F676C6F62616C00000000E0ABA693036936340000056D696E65720000CE6BB2E9A6930369363400000E6D696E696E676E66745F6974656D00000000609AA6B90369363400000572616E646F000000000C954DC60369363400000B636F6E74725F737461746500000000'
hex = hex[2:]
decoded_text = ""
for index in range(0,len(hex),2):
hexadecimal = hex[index:index+2]
ascii_text = bytes.fromhex(hexadecimal).decode(errors='ignore')
decoded_text += ascii_text
print(decoded_text)
输出:
eosio::abi/1.1↨♥bag♥account♦name♣itemuint64[]♠locked♦bool
claim_item☻♣miner♦name♀template_iduint32[] claimnfts☺♣miner♦name clearbags♂clearminers♀contr_global♥►delay_multiplier♠uint16☼luck_multiplier♠uint16☼ease_multiplier♠uint16♂contr_state♦♫last_fill_time
time_point fill_ratefloat64♀bucket_total♣asset♂mine_bucket♣assetdeposit☻account♦namquantity♣asset♦fill☻account♦name♂planet_name♦namelogmine♥♣miner♦name♠params♂mining_data♠bounty♣asset♦mine☻♣miner♦name♣nonce♣bytes♣mine♣claim_item☻♣miner♦name♀template_iduint32[] claimnfts☺♣miner♦name clearbags♂clearminers♀contr_global♥►delay_multiplier♠uint16☼luck_multiplier♠uint16☼ease_multiplier♠uint16♂contr_state♦♫last_fill_time
time_point fill_ratefloat64♀bucket_total♣asset♂mine_bucket♣assetdeposit☻account♦namquantity♣asset♦fill☻account♦name♂planet_name♦namelogmine♥♣miner♦name♠params♂mining_data♠bounty♣asset♦mine☻♣miner♦name♣nonce♣bytes♣mine♣miner♦name♀last_mine_tx♂checksum256 last_mine♫time_point_sec♀current_land♠uint64♂mining_datainvalid♣uint8♣error♠string♣delay♠uint16
difficulty♣uint8♦ease♣uint8♦luck♣uint8
commission♠uint16♫miningnft_item☻♠rarity♦name♀template_iduint32[procrand♣rando☻☻id♠uint64account♦name♂receiverandassoc_id♠uint64♀random_value♂checksum256
resetstate☺♂planet_name♦name♠setbag☻account♦name♣itemuint64[]setland☻account♦nameland_id♠uint64♂setlandnick♥account♦nameland_id♠uint6nickname♠stringsetnfts☻♠rarity♦name♀template_iduint32[]♀setprofitshr♥account♦nameland_id♠uint64♀profit_share♠uint16♫yMLD claimnftskTD clearbagsUkTD♂clearminers►[♦fill@M'↓logmine♦mineprocrand4Wm♂receiverand&
resetstate0s♠setbag M‼setland r3M‼♂setlandnick5setnftsp[♀setprofitsh9♥i64♥bag`LD♥i64
claim_item8;LJ♥i64depositDshd♥i64♀contr_global♥i64♣minerk♥i64♫miningnft_item`♥i64♣rando♀M♥i64♂contr_state
它并不完美,但您可以在某些方面对其进行改进,过滤掉 none- 像不同符号一样的常规字符。基本上操作是读取您拥有的字符串中的 2 个字符,它们代表一个十六进制数,然后将该十六进制数转换为一个字符串(但在此代码中首先转换为一个字节,也许您可以想出更直接的转换). .decode()
函数中的参数 errors='ignore'
非常重要,因为您的十六进制代码充满了不可读的十六进制数
这里有一个稍微不同的方法。看起来(有效)字符是 8 位的,但其中似乎有很多不可打印的内容。此代码用句点替换任何无法转换(解码)的内容。
hs = '0E656F73696F3A3A6162692F312E310017036261670003076163636F756E74046E616D65056974656D730875696E7436345B5D066C6F636B656404626F6F6C0A636C61696D5F6974656D0002056D696E6572046E616D650C74656D706C6174655F6964730875696E7433325B5D09636C61696D6E6674730001056D696E6572046E616D6509636C6561726261677300000B636C6561726D696E65727300000C636F6E74725F676C6F62616C00031064656C61795F6D756C7469706C6965720675696E7431360F6C75636B5F6D756C7469706C6965720675696E7431360F656173655F6D756C7469706C6965720675696E7431360B636F6E74725F737461746500040E6C6173745F66696C6C5F74696D650A74696D655F706F696E740966696C6C5F7261746507666C6F617436340C6275636B65745F746F74616C0561737365740B6D696E655F6275636B6574056173736574076465706F7369740002076163636F756E74046E616D65087175616E746974790561737365740466696C6C0002076163636F756E74046E616D650B706C616E65745F6E616D65046E616D65076C6F676D696E650003056D696E6572046E616D6506706172616D730B6D696E696E675F6461746106626F756E7479056173736574046D696E650002056D696E6572046E616D65056E6F6E6365056279746573056D696E65720004056D696E6572046E616D650C6C6173745F6D696E655F74780B636865636B73756D323536096C6173745F6D696E650E74696D655F706F696E745F7365630C63757272656E745F6C616E640675696E7436340B6D696E696E675F64617461000707696E76616C69640575696E7438056572726F7206737472696E670564656C61790675696E7431360A646966666963756C74790575696E743804656173650575696E7438046C75636B0575696E74380A636F6D6D697373696F6E0675696E7431360E6D696E696E676E66745F6974656D000206726172697479046E616D650C74656D706C6174655F6964730875696E7433325B5D0870726F6372616E6400000572616E646F00020269640675696E743634076163636F756E74046E616D650B7265636569766572616E640002086173736F635F69640675696E7436340C72616E646F6D5F76616C75650B636865636B73756D3235360A7265736574737461746500010B706C616E65745F6E616D65046E616D65067365746261670002076163636F756E74046E616D65056974656D730875696E7436345B5D077365746C616E640002076163636F756E74046E616D65076C616E645F69640675696E7436340B7365746C616E646E69636B0003076163636F756E74046E616D65076C616E645F69640675696E743634086E69636B6E616D6506737472696E67077365746E667473000206726172697479046E616D650C74656D706C6174655F6964730875696E7433325B5D0C73657470726F6669747368720003076163636F756E74046E616D65076C616E645F69640675696E7436340C70726F6669745F73686172650675696E7431360E0000C0794DE94C4409636C61696D6E667473000000C0CC9C6B544409636C656172626167730000F055D3C96B54440B636C6561726D696E65727300000000000010A35B0466696C6C00000000404D27198D076C6F676D696E65000000000000A0A693046D696E6500000000699A8BE8AD0870726F6372616E640000D234576DA790BA0B7265636569766572616E64000080CA26E3ACB0BA0A7265736574737461746500000000003073B2C20673657462616700000000204D13B3C2077365746C616E6400002072334D13B3C20B7365746C616E646E69636B0000000000E735B3C2077365746E66747300701BCE6ED15BB3C20C73657470726F66697473687200080000000000809939036936340000036261670000000060E94C440369363400000A636C61696D5F6974656D000000383B4CAB4A036936340000076465706F73697400000000447368640369363400000C636F6E74725F676C6F62616C00000000E0ABA693036936340000056D696E65720000CE6BB2E9A6930369363400000E6D696E696E676E66745F6974656D00000000609AA6B90369363400000572616E646F000000000C954DC60369363400000B636F6E74725F737461746500000000'
out = []
NPC = 2 # nibbles per character
CODESET = 'utf_8'
for i in range(0, len(hs), NPC):
try:
a = bytes.fromhex(hs[i:i+NPC]).decode(CODESET)
out.append(a)
except Exception:
out.append('.')
print(''.join(out))
我有以下十六进制字符串
hex = '0E656F73696F3A3A6162692F312E310017036261670003076163636F756E74046E616D65056974656D730875696E7436345B5D066C6F636B656404626F6F6C0A636C61696D5F6974656D0002056D696E6572046E616D650C74656D706C6174655F6964730875696E7433325B5D09636C61696D6E6674730001056D696E6572046E616D6509636C6561726261677300000B636C6561726D696E65727300000C636F6E74725F676C6F62616C00031064656C61795F6D756C7469706C6965720675696E7431360F6C75636B5F6D756C7469706C6965720675696E7431360F656173655F6D756C7469706C6965720675696E7431360B636F6E74725F737461746500040E6C6173745F66696C6C5F74696D650A74696D655F706F696E740966696C6C5F7261746507666C6F617436340C6275636B65745F746F74616C0561737365740B6D696E655F6275636B6574056173736574076465706F7369740002076163636F756E74046E616D65087175616E746974790561737365740466696C6C0002076163636F756E74046E616D650B706C616E65745F6E616D65046E616D65076C6F676D696E650003056D696E6572046E616D6506706172616D730B6D696E696E675F6461746106626F756E7479056173736574046D696E650002056D696E6572046E616D65056E6F6E6365056279746573056D696E65720004056D696E6572046E616D650C6C6173745F6D696E655F74780B636865636B73756D323536096C6173745F6D696E650E74696D655F706F696E745F7365630C63757272656E745F6C616E640675696E7436340B6D696E696E675F64617461000707696E76616C69640575696E7438056572726F7206737472696E670564656C61790675696E7431360A646966666963756C74790575696E743804656173650575696E7438046C75636B0575696E74380A636F6D6D697373696F6E0675696E7431360E6D696E696E676E66745F6974656D000206726172697479046E616D650C74656D706C6174655F6964730875696E7433325B5D0870726F6372616E6400000572616E646F00020269640675696E743634076163636F756E74046E616D650B7265636569766572616E640002086173736F635F69640675696E7436340C72616E646F6D5F76616C75650B636865636B73756D3235360A7265736574737461746500010B706C616E65745F6E616D65046E616D65067365746261670002076163636F756E74046E616D65056974656D730875696E7436345B5D077365746C616E640002076163636F756E74046E616D65076C616E645F69640675696E7436340B7365746C616E646E69636B0003076163636F756E74046E616D65076C616E645F69640675696E743634086E69636B6E616D6506737472696E67077365746E667473000206726172697479046E616D650C74656D706C6174655F6964730875696E7433325B5D0C73657470726F6669747368720003076163636F756E74046E616D65076C616E645F69640675696E7436340C70726F6669745F73686172650675696E7431360E0000C0794DE94C4409636C61696D6E667473000000C0CC9C6B544409636C656172626167730000F055D3C96B54440B636C6561726D696E65727300000000000010A35B0466696C6C00000000404D27198D076C6F676D696E65000000000000A0A693046D696E6500000000699A8BE8AD0870726F6372616E640000D234576DA790BA0B7265636569766572616E64000080CA26E3ACB0BA0A7265736574737461746500000000003073B2C20673657462616700000000204D13B3C2077365746C616E6400002072334D13B3C20B7365746C616E646E69636B0000000000E735B3C2077365746E66747300701BCE6ED15BB3C20C73657470726F66697473687200080000000000809939036936340000036261670000000060E94C440369363400000A636C61696D5F6974656D000000383B4CAB4A036936340000076465706F73697400000000447368640369363400000C636F6E74725F676C6F62616C00000000E0ABA693036936340000056D696E65720000CE6BB2E9A6930369363400000E6D696E696E676E66745F6974656D00000000609AA6B90369363400000572616E646F000000000C954DC60369363400000B636F6E74725F737461746500000000'
我即将使用
完全转换bytes.fromhex(hex)
我得到以下信息:
b"\x0eeosio::abi/1.1\x00\x17\x03bag\x00\x03\x07account\x04name\x05items\x08uint64[]\x06locked\x04bool\nclaim_item\x00\x02\x05miner\x04name\x0ctemplate_ids\x08uint32[]\tclaimnfts\x00\x01\x05miner\x04name\tclearbags\x00\x00\x0bclearminers\x00\x00\x0ccontr_global\x00\x03\x10delay_multiplier\x06uint16\x0fluck_multiplier\x06uint16\x0fease_multiplier\x06uint16\x0bcontr_state\x00\x04\x0elast_fill_time\ntime_point\tfill_rate\x07float64\x0cbucket_total\x05asset\x0bmine_bucket\x05asset\x07deposit\x00\x02\x07account\x04name\x08quantity\x05asset\x04fill\x00\x02\x07account\x04name\x0bplanet_name\x04name\x07logmine\x00\x03\x05miner\x04name\x06params\x0bmining_data\x06bounty\x05asset\x04mine\x00\x02\x05miner\x04name\x05nonce\x05bytes\x05miner\x00\x04\x05miner\x04name\x0clast_mine_tx\x0bchecksum256\tlast_mine\x0etime_point_sec\x0ccurrent_land\x06uint64\x0bmining_data\x00\x07\x07invalid\x05uint8\x05error\x06string\x05delay\x06uint16\ndifficulty\x05uint8\x04ease\x05uint8\x04luck\x05uint8\ncommission\x06uint16\x0eminingnft_item\x00\x02\x06rarity\x04name\x0ctemplate_ids\x08uint32[]\x08procrand\x00\x00\x05rando\x00\x02\x02id\x06uint64\x07account\x04name\x0breceiverand\x00\x02\x08assoc_id\x06uint64\x0crandom_value\x0bchecksum256\nresetstate\x00\x01\x0bplanet_name\x04name\x06setbag\x00\x02\x07account\x04name\x05items\x08uint64[]\x07setland\x00\x02\x07account\x04name\x07land_id\x06uint64\x0bsetlandnick\x00\x03\x07account\x04name\x07land_id\x06uint64\x08nickname\x06string\x07setnfts\x00\x02\x06rarity\x04name\x0ctemplate_ids\x08uint32[]\x0csetprofitshr\x00\x03\x07account\x04name\x07land_id\x06uint64\x0cprofit_share\x06uint16\x0e\x00\x00\xc0yM\xe9LD\tclaimnfts\x00\x00\x00\xc0\xcc\x9ckTD\tclearbags\x00\x00\xf0U\xd3\xc9kTD\x0bclearminers\x00\x00\x00\x00\x00\x00\x10\xa3[\x04fill\x00\x00\x00\x00@M'\x19\x8d\x07logmine\x00\x00\x00\x00\x00\x00\xa0\xa6\x93\x04mine\x00\x00\x00\x00i\x9a\x8b\xe8\xad\x08procrand\x00\x00\xd24Wm\xa7\x90\xba\x0breceiverand\x00\x00\x80\xca&\xe3\xac\xb0\xba\nresetstate\x00\x00\x00\x00\x000s\xb2\xc2\x06setbag\x00\x00\x00\x00 M\x13\xb3\xc2\x07setland\x00\x00 r3M\x13\xb3\xc2\x0bsetlandnick\x00\x00\x00\x00\x00\xe75\xb3\xc2\x07setnfts\x00p\x1b\xcen\xd1[\xb3\xc2\x0csetprofitshr\x00\x08\x00\x00\x00\x00\x00\x80\x999\x03i64\x00\x00\x03bag\x00\x00\x00\x00`\xe9LD\x03i64\x00\x00\nclaim_item\x00\x00\x008;L\xabJ\x03i64\x00\x00\x07deposit\x00\x00\x00\x00Dshd\x03i64\x00\x00\x0ccontr_global\x00\x00\x00\x00\xe0\xab\xa6\x93\x03i64\x00\x00\x05miner\x00\x00\xcek\xb2\xe9\xa6\x93\x03i64\x00\x00\x0eminingnft_item\x00\x00\x00\x00`\x9a\xa6\xb9\x03i64\x00\x00\x05rando\x00\x00\x00\x00\x0c\x95M\xc6\x03i64\x00\x00\x0bcontr_state\x00\x00\x00\x00"
我显然漏掉了解码的一个步骤,如果我将数据插入这个网站,https://string-functions.com/hex-string.aspx
我得到了更易读的东西,尽管并不完美
eosio::abi/1.1bagaccountnameitemsuint64[]lockedbool
claim_itemminernametemplate_idsuint32[] claimnftsminername clearbagsclearminerscontr_globaldelay_multiplieruint16luck_multiplieruint16ease_multiplieruint16contr_statelast_fill_time
time_point fill_ratefloat64bucket_totalassetmine_bucketassetdepositaccountnamequantityassetfillaccountnameplanet_namenamelogmineminernameparamsmining_databountyassetmineminernamenoncebytesminerminernamelast_mine_txchecksum256 last_minetime_point_seccurrent_landuint64mining_datainvaliduint8errorstringdelayuint16
difficultyuint8easeuint8luckuint8
commissionuint16miningnft_itemraritynametemplate_idsuint32[]procrandrandoiduint64accountnamereceiverandassoc_iduint64random_valuechecksum256
resetstateplanet_namenamesetbagaccountnameitemsuint64[]setlandaccountnameland_iduint64setlandnickaccountnameland_iduint64nicknamestringsetnftsraritynametemplate_idsuint32[]setprofitshraccountnameland_iduint64profit_shareuint16ÀyMéLD claimnftsÀÌœkTD clearbagsðUÓÉkTDclearminers£[fill@M'logmine ¦“mineiš‹èprocrandÒ4Wm§ºreceiverand€Ê&㬰º
resetstate0s²Âsetbag M³Âsetland r3M³Âsetlandnickç5³ÂsetnftspÎnÑ[³Âsetprofitshr€™9i64bag`éLDi64
claim_item8;L«Ji64depositDshdi64contr_global૦“i64minerÎk²é¦“i64miningnft_item`š¦¹i64rando•MÆi64contr_state
你可以这样做:
hex = '0E656F73696F3A3A6162692F312E310017036261670003076163636F756E74046E616D65056974656D730875696E7436345B5D066C6F636B656404626F6F6C0A636C61696D5F6974656D0002056D696E6572046E616D650C74656D706C6174655F6964730875696E7433325B5D09636C61696D6E6674730001056D696E6572046E616D6509636C6561726261677300000B636C6561726D696E65727300000C636F6E74725F676C6F62616C00031064656C61795F6D756C7469706C6965720675696E7431360F6C75636B5F6D756C7469706C6965720675696E7431360F656173655F6D756C7469706C6965720675696E7431360B636F6E74725F737461746500040E6C6173745F66696C6C5F74696D650A74696D655F706F696E740966696C6C5F7261746507666C6F617436340C6275636B65745F746F74616C0561737365740B6D696E655F6275636B6574056173736574076465706F7369740002076163636F756E74046E616D65087175616E746974790561737365740466696C6C0002076163636F756E74046E616D650B706C616E65745F6E616D65046E616D65076C6F676D696E650003056D696E6572046E616D6506706172616D730B6D696E696E675F6461746106626F756E7479056173736574046D696E650002056D696E6572046E616D65056E6F6E6365056279746573056D696E65720004056D696E6572046E616D650C6C6173745F6D696E655F74780B636865636B73756D323536096C6173745F6D696E650E74696D655F706F696E745F7365630C63757272656E745F6C616E640675696E7436340B6D696E696E675F64617461000707696E76616C69640575696E7438056572726F7206737472696E670564656C61790675696E7431360A646966666963756C74790575696E743804656173650575696E7438046C75636B0575696E74380A636F6D6D697373696F6E0675696E7431360E6D696E696E676E66745F6974656D000206726172697479046E616D650C74656D706C6174655F6964730875696E7433325B5D0870726F6372616E6400000572616E646F00020269640675696E743634076163636F756E74046E616D650B7265636569766572616E640002086173736F635F69640675696E7436340C72616E646F6D5F76616C75650B636865636B73756D3235360A7265736574737461746500010B706C616E65745F6E616D65046E616D65067365746261670002076163636F756E74046E616D65056974656D730875696E7436345B5D077365746C616E640002076163636F756E74046E616D65076C616E645F69640675696E7436340B7365746C616E646E69636B0003076163636F756E74046E616D65076C616E645F69640675696E743634086E69636B6E616D6506737472696E67077365746E667473000206726172697479046E616D650C74656D706C6174655F6964730875696E7433325B5D0C73657470726F6669747368720003076163636F756E74046E616D65076C616E645F69640675696E7436340C70726F6669745F73686172650675696E7431360E0000C0794DE94C4409636C61696D6E667473000000C0CC9C6B544409636C656172626167730000F055D3C96B54440B636C6561726D696E65727300000000000010A35B0466696C6C00000000404D27198D076C6F676D696E65000000000000A0A693046D696E6500000000699A8BE8AD0870726F6372616E640000D234576DA790BA0B7265636569766572616E64000080CA26E3ACB0BA0A7265736574737461746500000000003073B2C20673657462616700000000204D13B3C2077365746C616E6400002072334D13B3C20B7365746C616E646E69636B0000000000E735B3C2077365746E66747300701BCE6ED15BB3C20C73657470726F66697473687200080000000000809939036936340000036261670000000060E94C440369363400000A636C61696D5F6974656D000000383B4CAB4A036936340000076465706F73697400000000447368640369363400000C636F6E74725F676C6F62616C00000000E0ABA693036936340000056D696E65720000CE6BB2E9A6930369363400000E6D696E696E676E66745F6974656D00000000609AA6B90369363400000572616E646F000000000C954DC60369363400000B636F6E74725F737461746500000000'
hex = hex[2:]
decoded_text = ""
for index in range(0,len(hex),2):
hexadecimal = hex[index:index+2]
ascii_text = bytes.fromhex(hexadecimal).decode(errors='ignore')
decoded_text += ascii_text
print(decoded_text)
输出:
eosio::abi/1.1↨♥bag♥account♦name♣itemuint64[]♠locked♦bool
claim_item☻♣miner♦name♀template_iduint32[] claimnfts☺♣miner♦name clearbags♂clearminers♀contr_global♥►delay_multiplier♠uint16☼luck_multiplier♠uint16☼ease_multiplier♠uint16♂contr_state♦♫last_fill_time
time_point fill_ratefloat64♀bucket_total♣asset♂mine_bucket♣assetdeposit☻account♦namquantity♣asset♦fill☻account♦name♂planet_name♦namelogmine♥♣miner♦name♠params♂mining_data♠bounty♣asset♦mine☻♣miner♦name♣nonce♣bytes♣mine♣claim_item☻♣miner♦name♀template_iduint32[] claimnfts☺♣miner♦name clearbags♂clearminers♀contr_global♥►delay_multiplier♠uint16☼luck_multiplier♠uint16☼ease_multiplier♠uint16♂contr_state♦♫last_fill_time
time_point fill_ratefloat64♀bucket_total♣asset♂mine_bucket♣assetdeposit☻account♦namquantity♣asset♦fill☻account♦name♂planet_name♦namelogmine♥♣miner♦name♠params♂mining_data♠bounty♣asset♦mine☻♣miner♦name♣nonce♣bytes♣mine♣miner♦name♀last_mine_tx♂checksum256 last_mine♫time_point_sec♀current_land♠uint64♂mining_datainvalid♣uint8♣error♠string♣delay♠uint16
difficulty♣uint8♦ease♣uint8♦luck♣uint8
commission♠uint16♫miningnft_item☻♠rarity♦name♀template_iduint32[procrand♣rando☻☻id♠uint64account♦name♂receiverandassoc_id♠uint64♀random_value♂checksum256
resetstate☺♂planet_name♦name♠setbag☻account♦name♣itemuint64[]setland☻account♦nameland_id♠uint64♂setlandnick♥account♦nameland_id♠uint6nickname♠stringsetnfts☻♠rarity♦name♀template_iduint32[]♀setprofitshr♥account♦nameland_id♠uint64♀profit_share♠uint16♫yMLD claimnftskTD clearbagsUkTD♂clearminers►[♦fill@M'↓logmine♦mineprocrand4Wm♂receiverand&
resetstate0s♠setbag M‼setland r3M‼♂setlandnick5setnftsp[♀setprofitsh9♥i64♥bag`LD♥i64
claim_item8;LJ♥i64depositDshd♥i64♀contr_global♥i64♣minerk♥i64♫miningnft_item`♥i64♣rando♀M♥i64♂contr_state
它并不完美,但您可以在某些方面对其进行改进,过滤掉 none- 像不同符号一样的常规字符。基本上操作是读取您拥有的字符串中的 2 个字符,它们代表一个十六进制数,然后将该十六进制数转换为一个字符串(但在此代码中首先转换为一个字节,也许您可以想出更直接的转换). .decode()
函数中的参数 errors='ignore'
非常重要,因为您的十六进制代码充满了不可读的十六进制数
这里有一个稍微不同的方法。看起来(有效)字符是 8 位的,但其中似乎有很多不可打印的内容。此代码用句点替换任何无法转换(解码)的内容。
hs = '0E656F73696F3A3A6162692F312E310017036261670003076163636F756E74046E616D65056974656D730875696E7436345B5D066C6F636B656404626F6F6C0A636C61696D5F6974656D0002056D696E6572046E616D650C74656D706C6174655F6964730875696E7433325B5D09636C61696D6E6674730001056D696E6572046E616D6509636C6561726261677300000B636C6561726D696E65727300000C636F6E74725F676C6F62616C00031064656C61795F6D756C7469706C6965720675696E7431360F6C75636B5F6D756C7469706C6965720675696E7431360F656173655F6D756C7469706C6965720675696E7431360B636F6E74725F737461746500040E6C6173745F66696C6C5F74696D650A74696D655F706F696E740966696C6C5F7261746507666C6F617436340C6275636B65745F746F74616C0561737365740B6D696E655F6275636B6574056173736574076465706F7369740002076163636F756E74046E616D65087175616E746974790561737365740466696C6C0002076163636F756E74046E616D650B706C616E65745F6E616D65046E616D65076C6F676D696E650003056D696E6572046E616D6506706172616D730B6D696E696E675F6461746106626F756E7479056173736574046D696E650002056D696E6572046E616D65056E6F6E6365056279746573056D696E65720004056D696E6572046E616D650C6C6173745F6D696E655F74780B636865636B73756D323536096C6173745F6D696E650E74696D655F706F696E745F7365630C63757272656E745F6C616E640675696E7436340B6D696E696E675F64617461000707696E76616C69640575696E7438056572726F7206737472696E670564656C61790675696E7431360A646966666963756C74790575696E743804656173650575696E7438046C75636B0575696E74380A636F6D6D697373696F6E0675696E7431360E6D696E696E676E66745F6974656D000206726172697479046E616D650C74656D706C6174655F6964730875696E7433325B5D0870726F6372616E6400000572616E646F00020269640675696E743634076163636F756E74046E616D650B7265636569766572616E640002086173736F635F69640675696E7436340C72616E646F6D5F76616C75650B636865636B73756D3235360A7265736574737461746500010B706C616E65745F6E616D65046E616D65067365746261670002076163636F756E74046E616D65056974656D730875696E7436345B5D077365746C616E640002076163636F756E74046E616D65076C616E645F69640675696E7436340B7365746C616E646E69636B0003076163636F756E74046E616D65076C616E645F69640675696E743634086E69636B6E616D6506737472696E67077365746E667473000206726172697479046E616D650C74656D706C6174655F6964730875696E7433325B5D0C73657470726F6669747368720003076163636F756E74046E616D65076C616E645F69640675696E7436340C70726F6669745F73686172650675696E7431360E0000C0794DE94C4409636C61696D6E667473000000C0CC9C6B544409636C656172626167730000F055D3C96B54440B636C6561726D696E65727300000000000010A35B0466696C6C00000000404D27198D076C6F676D696E65000000000000A0A693046D696E6500000000699A8BE8AD0870726F6372616E640000D234576DA790BA0B7265636569766572616E64000080CA26E3ACB0BA0A7265736574737461746500000000003073B2C20673657462616700000000204D13B3C2077365746C616E6400002072334D13B3C20B7365746C616E646E69636B0000000000E735B3C2077365746E66747300701BCE6ED15BB3C20C73657470726F66697473687200080000000000809939036936340000036261670000000060E94C440369363400000A636C61696D5F6974656D000000383B4CAB4A036936340000076465706F73697400000000447368640369363400000C636F6E74725F676C6F62616C00000000E0ABA693036936340000056D696E65720000CE6BB2E9A6930369363400000E6D696E696E676E66745F6974656D00000000609AA6B90369363400000572616E646F000000000C954DC60369363400000B636F6E74725F737461746500000000'
out = []
NPC = 2 # nibbles per character
CODESET = 'utf_8'
for i in range(0, len(hs), NPC):
try:
a = bytes.fromhex(hs[i:i+NPC]).decode(CODESET)
out.append(a)
except Exception:
out.append('.')
print(''.join(out))