Post AWFxMo5edIDOkNN3Uu by apgarcia@fosstodon.org
 (DIR) More posts by apgarcia@fosstodon.org
 (DIR) Post #AWFxMlajvGIWzutL28 by encthenet@flyovercountry.social
       2023-06-01T17:58:07Z
       
       0 likes, 0 repeats
       
       I am thinking of putting a proper CLI on the Shamir's secret sharing program I wrote recently, and ran into the big disconnect between usability and binary data.a) To parse the #Python repr output of a bytes string, you can't, the closest is ast.literal_eval, but that allows any type, not a specific one (yes, you can check the return type but it has other issues).
       
 (DIR) Post #AWFxMmLB8bRdJwcQPw by encthenet@flyovercountry.social
       2023-06-01T18:04:23Z
       
       0 likes, 0 repeats
       
       b) No POSIX standard binary to hex encoder/decoder.  od comes close for decode, but requires post processing (I guess uuencode/decode -m comes close, but still requires significant processing).b is important because it means that programs end up having to do encoding/decoding themselves, and you can't mix between a command argument or stdin as easily (e.g. no: cmd $(cat bindata | hexencoder), but requires bindata to be in a file, or via a pipe).
       
 (DIR) Post #AWFxMmrRCfFUvziBhQ by encthenet@flyovercountry.social
       2023-06-01T18:11:17Z
       
       0 likes, 0 repeats
       
       Yes, there are plenty of non-POSIX options (or complicated POSIX options that most people don't want to use), openssl, python, awk, etc. but they aren't cross platform.This means that for the program, which ostensibly generates human handlable data, it gets complicated.  Now you have to support parsing formats, e.g. hex data so that a user doesn't have to decode and store it in a file themselves.
       
 (DIR) Post #AWFxMo5edIDOkNN3Uu by apgarcia@fosstodon.org
       2023-06-01T18:25:21Z
       
       0 likes, 0 repeats
       
       @encthenet for b) you can use xxd, no? i think it originally was packaged with vim, so it's pretty widespread...
       
 (DIR) Post #AWFxMyI4hy5mNnG7FI by encthenet@flyovercountry.social
       2023-06-01T18:42:06Z
       
       0 likes, 0 repeats
       
       @apgarcia FreeBSD doesn't ship xxd, though MacOSX does.  So on most of my systems, it isn't there.Like w/ all non-"standard" options, I can document one (or many), but it really becomes a make the user have to learn/do more work increasing the cost to using the program.It impacts the total UX.If I went w/ a non-standard option, it'd likely be openssl enc.
       
 (DIR) Post #AWFxN0ALjf6KCPeyTw by feld@bikeshed.party
       2023-06-01T18:55:13.605297Z
       
       0 likes, 0 repeats
       
       hexdump is available on MacOS, FreeBSD, and Debian (via util-linux, seemingly installed by default as a dep for systemd)