Skip to content
This repository was archived by the owner on Jan 13, 2023. It is now read-only.
This repository was archived by the owner on Jan 13, 2023. It is now read-only.

Seed.__init__ should raise a warning when the seed is longer than 81 trytes #45

@todofixthis

Description

@todofixthis

Beyond 81 trytes, you can't increase the security of your seed — not even against brute force attacks (see Why aren't seeds longer than 81 trytes more secure? for more info).

We should still allow users to create seeds longer than 81 trytes, just in case, but this should cause a warning to be raised. The error message should include a link to the above forum post.

Example:

# 81 trytes; this is OK.
seed = Seed(b'9' * Hash.LEN)

# 82 trytes; this should raise a warning (note: not an exception)
seed = Seed(b'9' * (Hash.LEN + 1))

# If the user is sure they know what they are doing, they can suppress the warning.
with warnings.catch_warnings():
  warnings.simplefilter('ignore')
  seed = Seed(b'9' * (Hash.LEN + 1))

Note: Do not strip trailing 9s when checking the length.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions