simpleHash static method

String simpleHash(
  1. String data
)

Hash data (simple hash for non-cryptographic purposes)

Implementation

static String simpleHash(String data) {
  var hash = 0;
  for (var i = 0; i < data.length; i++) {
    hash = ((hash << 5) - hash) + data.codeUnitAt(i);
    hash = hash & hash; // Convert to 32-bit integer
  }
  return hash.abs().toString();
}