Anonymous user
One-time pad: Difference between revisions
→Python: I didn't realize it was better to use multiple lines of import statements rather than comma-separated import statements. I am changing this back to import on different lines based on a suggestion from PyCharm Professional.
m (→{{header|Wren}}: Minor tidy) |
imported>EliteSuperiorIntelligenceSocialStandingWealthPowerfulRichGiftedEducatedUpperClassUpperCrustCrèmedelaCrème (→Python: I didn't realize it was better to use multiple lines of import statements rather than comma-separated import statements. I am changing this back to import on different lines based on a suggestion from PyCharm Professional.) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1,467:
import secrets
import sys
# One-time pad file signature.
Line 1,476 ⟶ 1,475:
"""Generate ``n`` secure, random keys of ``size`` bytes."""
# We're generating and storing keys in their hexadecimal form to make
# one-time pad files a little more human
# can not start with a hyphen.
return (secrets.token_hex(size) for _ in range(n))
Line 1,549 ⟶ 1,548:
Args:
path (pathlib.Path): Path to write one-time pad to.
key_size (int): The number of bytes per key.
"""
if path.exists():
|