Skip to content

Allow users to pass in their own byte arrays #4

@kevinburke

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..

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