Skip to content

Support passing byte arrays to lazy methods instead of strings #109

@Traderjoe95

Description

@Traderjoe95

Using plain strings as input to hash, encryption, etc. functions doesn't work very well for binary data. I have experienced several issues where decoding the data to a string before encrypting it would lose some bytes because they weren't valid in the respective encoding.

I would suggest to

  1. supply another batch of lazy methods for GenericHash, SecretBox, AEAD and others that take byte arrays as their respective messages directly. They may return either a hex string or a byte array, both are good options, really.
  2. clarify the API regarding what type of string is expected as an input. At the moment, the usage of String as the parameter type is ambiguous as sometimes it means "hex string" and sometimes it means "plain string". Maybe this can be clarified through the parameter name, e.g. plainMessage vs hexCipher

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions