PKVWKzziota_mnemonic/__init__.py"""Generate, recover IOTA seed from Bitcoin BIP39 mnemonic""" from .iotamnemonic import IOTAMnemonic __version__ = '0.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.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.1.dist-info/WHEEL HM K-*ϳR03rOK-J,/RH,Q0343 /, (-JLR()*M ILR(4KM̫#DPK!H$iota_mnemonic-0.1.dist-info/METADATAVm_1 ɵBQ$J^·VH.$"CQq"@>m@cG:%ݝ㤇rgٙg^vZ4!s!1a im0AH2O+PA@ĺ =A=~I 1sXt{YDx*I%tVx yʨ>&̣aGmr(-Nwg4 /"Z!Tk&Go=ӣLY#.'VISHIP*AoB90-78/ .&2E~v\ݼv/+"(T%y06 "PZ|4d h\93zmI 5'my k ~+דMsW,%1H8s1rT?K!aWݻw~hx ,g{'B̂_HCHF <PA$>x+.i#7KeABhğSM<sIMqƃY± 1mw'~z9);JkDZ{G+.!蒈}xYޝ͓$飰ܣb ^:C%g2fT$k$`=ElI#,O QDqk msFE0K?L)/"j# xΗ4K>Q;r{Nf4ި Y%c.&Nf;nunuhVjtiƽӬu6j7L{4Vi6*]}Zq'͗ﶛo_^~vl{y|[.6_m7ߩW_?j\sm7(W9_[/?כܚgvΥoϷjRǝ}l7;̔?H{3ݙJ{ߨ^vIz)_~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