本文整理汇总了Python中mnemonic.Mnemonic.encode方法的典型用法代码示例。如果您正苦于以下问题:Python Mnemonic.encode方法的具体用法?Python Mnemonic.encode怎么用?Python Mnemonic.encode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mnemonic.Mnemonic
的用法示例。
在下文中一共展示了Mnemonic.encode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _check_list
# 需要导入模块: from mnemonic import Mnemonic [as 别名]
# 或者: from mnemonic.Mnemonic import encode [as 别名]
def _check_list(self, language, vectors):
mnemo = Mnemonic(language)
for v in vectors:
code = mnemo.encode(unhexlify(v[0]))
data = hexlify(mnemo.decode(code))
self.assertEqual(v[1], code)
self.assertEqual(v[0], data)
print "input: ", v[0], "(%d bits)" % len(v[0] * 4)
print "mnemonic:", code, "(%d words)" % len(code.split(' '))
print
示例2: make_seed
# 需要导入模块: from mnemonic import Mnemonic [as 别名]
# 或者: from mnemonic.Mnemonic import encode [as 别名]
def make_seed(self, nbits=128, entropy=1, language=None):
"""Create a seed"""
from mnemonic import Mnemonic
s = Mnemonic(language).make_seed(nbits, custom_entropy=entropy)
return s.encode('utf8')
示例3: make_seed
# 需要导入模块: from mnemonic import Mnemonic [as 别名]
# 或者: from mnemonic.Mnemonic import encode [as 别名]
def make_seed(self, nbits, custom_entropy, language):
from mnemonic import Mnemonic
s = Mnemonic(language).make_seed(nbits, custom_entropy=custom_entropy)
return s.encode('utf8')