# Introducing the `bytes` and the `bits` command. Commands specifically made for finding and manipulating binary data. Since naming is hard, we may end up changing the name. :) # the `bytes` command ### potential crates for bytes * https://docs.rs/bytes/latest/bytes/ * https://github.com/cronosun/abin/ * https://github.com/Mackirac/binary_byte * https://github.com/gmantaos/file-utils - [x] `bytes` query the bytes of a buffer - [x] `bytes at` maybe thought of like `str sub-string`? - returns the byte at a specified offset in decimal 10 or hex 0x10 - returns the bytes in a range if specified like 1..10 - [x] `bytes index-of` aka `bytes contains` - finds the index of a specified hex byte 0x10 - finds the index of a specified byte buffer - [x] `bytes to-str` - point to `decode utf-8` - returns specified bytes as a utf-8 string - [x] `bytes build` - kind of like buildstring but for bytes - [x] `bytes size` aka `bytes length` - return the size of something in bytes - [x] `bytes collect` - collect bytes like str collect - [x] `bytes ends-with` - returns bool of whether a buffer ends with specified byte(s) - [x] `bytes find-replace` aka `bytes replace` - find and replace specified bytes - [x] `bytes add` - add specified bytes to the --start, --end, --index - [x] `bytes remove` - remove specified bytes from --start, --end, --index - [x] `bytes reverse` - reverse a buffer of bytes - [x] `bytes starts-with` - returns bool of whether a buffer starts with specified byte(s) # the `bits` command ### protentional crates for bits * https://github.com/kkayal/bitlab * https://github.com/RustyNixieTube/bit_op * https://github.com/niconii/twiddle * https://github.com/gnzlbg/bitwise - [x] `bits shl` aka `shift --left` aka `<<` -bitwise shift left moves bits left - [x] `bits shr` aka `shift --right` aka `>>` -bitwise shift right moves bits right - [x] `bits rol` aka `rotate --left` - bitwise shift left move a bit left and adds it to the right - [x] `bits ror` aka `rotate --right` - bitwise shift right move a bit right and adds it to the left - [x] `bits and` aka `&` - bitwise and performas logical and operation on each pair of bits - [x] `bits or` aka `|` - bitwise or performs logical or operation on each pair of bits - [x] `bits xor` aka `^` - bitwise xor perofrms logical exclusive or operation on each pair of bits - [x] `bits not` aka `~` aka `complement` - performs logical negation on each bit TBD - we could add later or make params or leave out and there are many more we could add * `sal` - shift arithmatic left * `sar` - shift arithmatic right * `rcl` - rotate carry left * `rcr` - rotate carry right * `shld` - shift left number of bits * `shrd` - shift right number of bits