ton-community / vscode-func

FunC syntax highlighting and code completion for VS Code.
GNU General Public License v3.0
26 stars 14 forks source link

Fix the bug in the `h`-string literal calculation. #12

Open a2468834 opened 4 months ago

a2468834 commented 4 months ago

The original calculation results in 64-bit hexadecimal string which is not consistent with the description in TON document.

h—creates an int constant that is the first 32 bits of the SHA256 hash of the string. https://docs.ton.org/develop/func/literals_identifiers

a2468834 commented 4 months ago

@alijawan Please do not leave irrelevant comments.

a2468834 commented 4 months ago

@dvlkv Hello 👋 I have found a bug related to prompt hexadecimal of h-string literals

In the TON document, ""h is defined as the first 32 bits of the SHA256 hash of the string literal. And I have verified this feature through compiling contract with v0.4.4 FunC compiler.

I believe this bug fix could be quite useful for the developers.