Skip to content

Allow users to pass in their own byte arrays #4

Description

@kevinburke

For example, the base64 api's have a user pass in a dst array to decode into. The nacl API's in golang.org/x/crypto follow a similar pattern.

The advantage of doing it this way is that it reduces allocations, which helps performance.

The disadvantage is that it requires the caller to know more about how the API works, and ensure they bring along a byte array that's large enough.

The C/C++ API's have it both ways. The C++ API's return a byte array, the C API's require you to pass one in, but I think the latter is because you can only return integers from C functions..

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions