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

charset_to_int drops characters on some inputs #6

@DoronShapiro

Description

@DoronShapiro

To reproduce:

>>> from utilitybelt import charset_to_int
>>> from utilitybelt import base32_chars
>>> charset_to_int("AARDVARK", base32_chars)
574259754
>>> charset_to_int("RDVARK", base32_chars)
574259754

When the leading characters of s are the first element of the charset, they are not included in the returned integer. This is because output starts as 0 and is then multiplied by some number added to an index, which in these cases is also 0.

This behavior becomes an issue in the secret sharing library (https://github.com/blockstack/secret-sharing/) that depends on utilitybelt, as it corrupts secrets and leaks information about secret contents.

One possible fix is to initialize output as 1 instead of 0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions