been there, done that; it is very useful.
1> [(file-get-string "/bin/ls") 0..15]
"\x7F;ELF\x02\x01\x01\xDC00\xDC00\xDC00\xDC00\xDC00\xDC00\xDC00\xDC00"
2> (file-put-string "foo" (file-get-string "/bin/ls"))
t
3> (sh "cmp /bin/ls foo")
0
4> (sh "sha256sum /bin/ls foo")
a90ba058c747458330ba26b5e2a744f4fc57f92f9d0c9112b1cb2f76c66c4ba0 /bin/ls
a90ba058c747458330ba26b5e2a744f4fc57f92f9d0c9112b1cb2f76c66c4ba0 foo
0
There is no need to handle any fractional bytes if the original input is a sequence of bytes; so many whole bytes have to be recovered, not so many whole bytes plus three bits or whatever.