Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The dart implementation behind String.hashCode for use in other language

I mistakenly depended on String.hashCode's value in a flutter app and stored it in a server side. Now I want to be able to calculate a hash code of a string in nodeJS and get the same result as dart...

How can I achieve it? Didn't find the actual implementation of the String.hashCode in dart.

like image 749
mik Avatar asked Feb 05 '26 10:02

mik


1 Answers

The vm implementation of String.hashCode can be found in the sdk repo on github (https://github.com/dart-lang/sdk):

Example:

  • StringHasher in runtime/vm/object.cc
  • CombineHashes/FinalizeHash in runtime/vm/hash.h
like image 139
Xavier Avatar answered Feb 08 '26 03:02

Xavier



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!