Hi guys,
How can i import the base 64 and md5 to my ionic 2 application.
I got an error using this to sites as reference:
https://www.npmjs.com/package/angular-utf8-base64
https://www.npmjs.com/package/angular-md5
When i import this packages my application open a blank page.
Thank you.
Both of these packages are built for Angular 1. Ionic 2 uses Angular 2.
Check this out: https://www.npmjs.com/package/crypto-js
I haven’t used it before. But I think this is how it can be used with Angular 2:
import * as CryptoJS from 'crypto-js';
// or: import CryptoJS = require('crypto-js');
...
CryptoJS.MD5('data here');
CryptoJS.enc.Base64.stringify('data here');
CryptoJS.enc.Base64.parse('base64 string here');
Here’s another idea on how it might work with Angular 2 without loading the whole library:
import * as Base64 from 'crypto-js/enc-base64';
import * as MD5 from 'crypto-js/md5';
Base64.stringify(...);
Base64.parse(...);
MD5( ... );
base64 - javascript inbuild method
md5 for javascript you could find very easy
You no need so heavy library like CryptoJS