Skip to main content
SVerm.3
Associate III
May 28, 2021
Solved

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

  • May 28, 2021
  • 2 replies
  • 6463 views

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.

This topic has been closed for replies.
Best answer by Piranha

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.

2 replies

MM..1
Super User
May 28, 2021

sprintf %x

SVerm.3
SVerm.3Author
Associate III
May 28, 2021

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

MM..1
Super User
May 28, 2021

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

Piranha
PiranhaBest answer
Principal III
May 30, 2021

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.

SVerm.3
SVerm.3Author
Associate III
May 31, 2021

thanks Sir, means a lot...