PKXK||iota_mnemonic/__init__.py"""Generate, recover IOTA seed from Bitcoin BIP39 mnemonic""" from .iotamnemonic import IOTAMnemonic __version__ = '0.2.1' PKMK H{]]iota_mnemonic/__main__.py# -*- coding: utf-8 -*- import argparse from .iotamnemonic import IOTAMnemonic def main(): prog = 'iotamenomic' description = 'Create and recover IOTA seed from Bitcoin BIP39 mnemonic' parser = argparse.ArgumentParser(prog=prog, description=description) parser.add_argument('-s', '--strength', nargs='?', choices=[128, 160, 192, 224, 256], type=int, default=256) parser.add_argument('-l', '--language', nargs='?', default='english') parser.add_argument('-p', '--passphrase', nargs='?', default='') parser.add_argument('-o', '--output', help='Output path for mnemonic words') parser.add_argument('-f', '--infile') options = parser.parse_args() im = IOTAMnemonic(options.language) if options.infile: # Recover IOTA seed from mnemonic file mnemo = open(options.infile, 'r').read().strip() if not mnemo: raise ValueError(f'Can not read anything from file: {options.infile}') else: # Generate IOTA seed from Bitcoin bip39 menomic mnemo = im.generate(options.strength) if options.output: with open(options.output, 'w') as f: f.write(mnemo) else: print(f'Mnemonic: {mnemo}') print(f'IOTA Seed: {im.to_iota_seed(mnemo, options.passphrase)}') if __name__ == '__main__': main() PK TK+DDiota_mnemonic/iotamnemonic.py# -*- coding: utf-8 -*- import iota import mnemonic class IOTAMnemonic(mnemonic.Mnemonic): @classmethod def to_iota_seed(cls, mnemonic, passphrase=''): mnemonic = cls.normalize_string(mnemonic) passphrase = cls.normalize_string(passphrase) trits = [] sponge = iota.crypto.kerl.Kerl() for word in mnemonic.split(): hash = iota.Hash.from_string(f'mnemonic{passphrase}{word}') hash_trits = hash.as_trits() k = iota.crypto.kerl.Kerl() k.absorb(hash_trits) k.squeeze(hash_trits) sponge.absorb(hash_trits) sponge.squeeze(trits) return iota.Hash.from_trits(trits) if __name__ == '__main__': i = IOTAMnemonic('english') mnemo = i.generate(256) print(mnemo) print(i.to_iota_seed(mnemo)) PKMK8%iota_mnemonic-0.2.1.dist-info/LICENSECopyright 2017 Louie Lu Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PK!H١Wd#iota_mnemonic-0.2.1.dist-info/WHEEL HM K-*ϳR03rOK-J,/RH,Q0343 /, (-JLR()*M ILR(4KM̫#DPK!H#&iota_mnemonic-0.2.1.dist-info/METADATAW[~FwxKۊP)kQ#j$0Crr`(4nA`Qȃ-OVk; -rssوΕ.IQ~@|PW |P:/=P1TFqLN'.$="BhəTHխhb>9 .ZqU_xK.K(B!$Ȱkt{RM5d qd&ۅ3cU R"D`#7Itfm#Rp%HJRA=[G0B;Sl:bqiB&V ; +m0'N.BX7cNIta#- =Iɂn{k4+(L>/}PzpxpE:SGQ5|18X G1cAk( V۠zK,)X O {=Ґ;G;?)*OQD (9a WbCl5((J~>?  &e<>SI"3C ʷ~|A^ ?C?t3t"Lj g͂bq$c8FK]yńA~BEͱ q8z,VDbIl0XՆ7ێ1flGaiں5kauvw\5D5?vuiVG7fw^ uCHpwSB \`$F ܠ  TD"ix4˳o4/;7͝{C&Ļ-"Kf߳,]~e7_ʕ,z;1_er"Kd?_byvE~!rOyןr@I/ Կy+WL_[9,/tV(NuqZmjjT^F5UKjXojgZվhkjݛgvզzlޠjf ;E8Lk\,:cq ;6CqwP- tT$@=WTA.DS$5-~tu\$E -4%l^b pb(9 W"WC7@d.^0x?0B.jpQyś6К3lJ`UvZ7Zt]ZzձƤ0jzjvk5YVwWw^(~/4mLq;)F.ce1ǐW цpi=DݦQ'-EWc7&/+_AuF'x%wF؋KҤxx"n4e QT,+@vw a1KCUI!uR{QA3낞%Uztǿ22?k+Xy3o߄vjIN]F}A"7ǔ`,OiyB?dm =CEnoy+ \ NwvUºEŷۏ[KL%$MS_ho7PKXK||iota_mnemonic/__init__.pyPKMK H{]]iota_mnemonic/__main__.pyPK TK+DDGiota_mnemonic/iotamnemonic.pyPKMK8% iota_mnemonic-0.2.1.dist-info/LICENSEPK!H١Wd#%iota_mnemonic-0.2.1.dist-info/WHEELPK!H#&iota_mnemonic-0.2.1.dist-info/METADATAPK!H3X7$iota_mnemonic-0.2.1.dist-info/RECORDPK#j