Equivalent for generate_hash in javascript


If I need to use frappe.generate_hash in javascript, then what is the equivalent?

@Mohammed_Redha, appreciate your kindly help as I got this from below link that:


1 Like

@bghayad you have to define a new javascript function in your custom app :

   String.prototype.hash = function() {
  var self = this, range = Array(this.length);
  for(var i = 0; i < this.length; i++) {
    range[i] = i;
  return Array.prototype.map.call(range, function(i) {
    return self.charCodeAt(i).toString(16);

How to use it:

"Lorem Ipsum".hash()
1 Like