Ionic 2 to generate sha512 code


How to generate sha512 code in ionic 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

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

any idea?

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