solokeys / solo1-cli

Solo 1 library and CLI in Python
https://pypi.org/project/solo-python
Apache License 2.0
184 stars 69 forks source link

solo key rng hexbytes off by one bug #160

Open atoponce opened 2 years ago

atoponce commented 2 years ago

Executing the following command, note the output:

% solo key rng hexbytes --count 256
Number of bytes must be between 0 and 255, you passed 256
% solo key rng hexbytes --count 0  
8ecfe207757421cd382d6a01730742060ac0706bd19af3a30d848c12c87e9af5053c47e124918438b711c0afbccd25477f5f474596ddb2b5f0
% solo key rng hexbytes --count 1
08

Given the context, it doesn't make sense to request 0 bytes and a max limit of 255 bytes is an odd upper limit. This seems like an off-by-one bug where the number of bytes should be between 1 and 256.