How to convert each character of string to hex string in STM32F4 Discovery Board?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-28 6:00 AM
I am using STM32CUBEIDE and want to convert each character of string to Hex string in STM32F4 Discovery Board, as I want to mask my string and process masked data. Please help me asap.
Solved! Go to Solution.
- Labels:
-
STM32CubeIDE
-
STM32F4 Series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-30 10:50 AM
Most likely the author doesn't need any HEX conversion at all. It was already explained to him that HEX is just a typical text representation of binary data:
The "masking", which he is incapable of even explaining, seems to be this one:
https://datatracker.ietf.org/doc/html/rfc6455#section-5.3
A trivial algorithm with MOD and XOR operations. An ideal minor task for an absolute beginners like the author. One must learn the basics before making complex systems.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-28 6:51 AM
sprintf %x
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-28 8:00 AM
but I want to store in variable not to print...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-28 8:44 AM
Description
The C library function int sprintf(char *str, const char *format, ...) sends formatted output to a string pointed to, by str.
Declaration
Following is the declaration for sprintf() function.
int sprintf(char *str, const char *format, ...)
Parameters
- str − This is the pointer to an array of char elements where the resulting C string is stored
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-28 9:26 AM
You're not explaining this very well, and the problem sounds like a C 101 level task.
Mask? As in hide/obfuscate?
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-28 11:37 AM
yes and string should be masked i.e for websocket
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-29 12:48 AM
Please provide me the answer like I just need to convert the Json string message to Hex code and after that, I need to mask as well. for Websocket Client application (RFC6455).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-30 7:37 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-30 10:50 AM
Most likely the author doesn't need any HEX conversion at all. It was already explained to him that HEX is just a typical text representation of binary data:
The "masking", which he is incapable of even explaining, seems to be this one:
https://datatracker.ietf.org/doc/html/rfc6455#section-5.3
A trivial algorithm with MOD and XOR operations. An ideal minor task for an absolute beginners like the author. One must learn the basics before making complex systems.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-31 5:34 AM
thanks Sir, means a lot...
