MCPcopy Create free account
hub / github.com/ActiveState/code / main

Function main

recipes/Python/578797_Public_Key_Encryption_RSA/recipe-578797.py:168–181  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

166
167
168def main():
169 import doctest
170 print(doctest.testmod())
171
172 pubkey, privkey = keygen(2 ** 64)
173 msg = u'the quick brown fox jumped over the lazy dog ® ⌀'
174 h = encode(msg, pubkey, True)
175 p = decode(h, privkey, True)
176 print('-' * 20)
177 print('message:', msg)
178 print('encoded:', b64encode(h).decode())
179 print('decoded:', p)
180 print('private key:', key_to_str(privkey))
181 print('public key:', key_to_str(pubkey))
182
183if __name__ == '__main__':
184 main()

Callers 1

recipe-578797.pyFile · 0.70

Calls 6

printFunction · 0.85
key_to_strFunction · 0.85
keygenFunction · 0.70
encodeFunction · 0.70
decodeFunction · 0.70
decodeMethod · 0.45

Tested by

no test coverage detected