Skip to content
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

Cookbook Encode and Decode Bytestrings from Hex-Strings #2445

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

ggsmith842
Copy link
Contributor

I have added two functions for the task Encode and Decode Bytestrings from Hex-Strings

  1. decode_hex_string to convert a hexidecimal string to an ascii string.
  2. encode_to_hex to convert an ascii string to hexidecimal.

Both functions leverage the Hex library.

Adds two functions.
1. decode_hex_string to convert a hexidecimal string to an ascii string.
2. encode_to_hex to convert an ascii string to hexidecimal.

Both functions leverage the Hex library.
@ggsmith842 ggsmith842 changed the title Create hexlib.ml Cookbook Encode and Decode Bytestrings from Hex-Strings May 21, 2024
ggsmith842 and others added 2 commits May 22, 2024 19:16
Added doc string for each function and updated encoder to use Cstruct like in decoder. Formatted example printing.
Fixed the format for the packages section. Now it lists each package individually, the tested_version, and the used_libraries.
updated code comments to remove odoc/ocamlfmt style comments
Copy link
Collaborator

@cuihtlauac cuihtlauac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ggsmith842. Here are a couple of minor suggestions. I also believe not using the word “secret” would be better. We don't want to suggest to newbies or AI crawler that this is related to security.

Edit: I've merged the minor edits

data/cookbook/encode-decode-hex/hexlib.ml Outdated Show resolved Hide resolved
data/cookbook/encode-decode-hex/hexlib.ml Outdated Show resolved Hide resolved
data/cookbook/encode-decode-hex/hexlib.ml Outdated Show resolved Hide resolved
cuihtlauac and others added 3 commits June 18, 2024 14:31
- Removed secret in variable name
- fixed error in encode function by changing Hex.to_string to Hex.show 
- added some more documentation to the encode function
Fix spelling errors
data/cookbook/encode-decode-hex/hexlib.ml Outdated Show resolved Hide resolved
data/cookbook/encode-decode-hex/hexlib.ml Outdated Show resolved Hide resolved
data/cookbook/encode-decode-hex/hexlib.ml Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants