cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert each character of string to hex string in STM32F4 Discovery Board?

SVerm.3
Associate III

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Piranha
Chief II

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:

https://community.st.com/s/question/0D53W00000e2PvaSAE/how-to-convert-hex-to-float-midlittle-endian-cdab-in-stm32cubeide

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.

View solution in original post

9 REPLIES 9
MM..1
Chief II

sprintf %x

but I want to store in variable not to print...

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

You're not explaining this very well, and the problem sounds like a C 101 level task.

Mask? As in hide/obfuscate?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

yes and string should be masked i.e for websocket

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).

Piranha
Chief II

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:

https://community.st.com/s/question/0D53W00000e2PvaSAE/how-to-convert-hex-to-float-midlittle-endian-cdab-in-stm32cubeide

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.

thanks Sir, means a lot...