-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
change xxd dependency from hard to soft #181
base: main
Are you sure you want to change the base?
Conversation
4226ba8
to
054adb3
Compare
I would very much like to remove the dependency on However For example, the I'm interested in exploring alternatives and the To that end, can you describe in more detail what the |
That's really good to know. I now tested locally with 3.3.1 and got these failing:
But since the tests are not properly sandboxed, I checked out master (at af3bb46 ) and ran the tests again, only to find the exact same tests failing... Which tests are failing on your side?
π― And how do you suggest we reach enough certainty then? Run more granular matrix tests with different arch/openssl/etc versions? Which would those be? |
I don't know if there's wider support for the longer but maybe more common usage with 2 capture groups: printf interprets the escape sequences into binary |
The problem on MacOS seems to be that $ echo -n "deadbeaf00000bad" | sed "s/../\\\\x&/g"
\xde\xad\xbe\xaf\x00\x00\x0b\xad%
$ echo -n "deadbeaf00000bad" | sed "s/../\\\\x&/g" | xargs -0 printf '%b'
xdexadxbexafx00x00x0bxad% This happens on MacOS for shell versions:
Other times I have looked into an alternative to |
Bingo! My printf is the GNU version from homebrew's coreutils, not the macos /usr/bin/printf. I confirm. Same with Github is not showing anymore the pre-git-push-force commits (runs here), but I was also aiming for a bash-only solution based on https://stackoverflow.com/questions/42828273/bash-hex-to-ascii-is-possible-without-xxd-or-perl/42828523#42828523. Couldn't get it to work, but I bet the problem is between the chair and the keyboard (actually now that I tested I did also look into https://stackoverflow.com/questions/4614775/converting-hex-to-decimal-in-awk-or-sed After lots of trial and error, I cannot get a success run. Even my friends Google and ChatGPT are dry. Could we say that we have a bash function that works with a case statement checking if xxd is available, uses that, checks if perl is available, uses that, otherwise checks if sed+printf are reliable and uses that, otherwise it errors ? That would still mean that in a lot of cases xxd is not needed. Maybe we don't even need perl. Check if sed+printf (actually only printf or even echo) is reliable to convert PS: |
8fb82db
to
82fa2fe
Compare
82fa2fe
to
29ee59f
Compare
@jmurty See the new changeset |
xxd is a dependency for openssl 3+ environments,
but xxd is packaged with vim,
which basically translates to
"transcrypt has a dependency on vim" ππ€¦ββοΈ
In order to keep the dependencies slim, and vim is not slim,
here's an attempt to replace xxd with sed and xargs.
Alternatively, perl also seems to work
perl -pe "s/([0-9A-Fa-f]{2})/chr(hex(\$1))/eg"
instead ofxxd -r -p
. Maybe there are other/better ways.sed+xargs, and even perl, are much more easily available, if not readily available, than xxd (vim). Think automation (CI/CD, docker) - you don't install a full-blown editor, but if you need to decrypt with transcrypt, currently you need to install one...
NOTE I am not π― sure this is safe and that there's no edge cases, but it looks alright e.g.