Ionic 2 to generate sha512 code


#1

Hi,

How to generate sha512 code in ionic 2.

Thanks.


#2

I would use WebCrypto:

let data: Uint8Array = [whatever];
crypto.subtle.digest({name: "SHA-512"}, data).then((hash) => {
  hash is an ArrayBuffer of the SHA-512 digest
});

#3

Worked with iOS, but I got “Cannot read property ‘digest’ of undefined” on Android.

any idea?


#4

Perhaps if Android stock webview is really old on that device, it might not have subtlecrypto. You could try using the wkwebviewengine plugin.