Storage Classes
About storage with cryptographic algorithms.
AES Storage
The Advanced Encryption Standard (AES) is a U.S. Federal Information Processing Standard (FIPS).
It was selected after a 5-year process where 15 competing designs were evaluated.
copy
import {AesStorage} from 'crypto-js-storage';
AesStorage.setItem('myCat', 'Tom', 'Secret Passphrase');
const cat = AesStorage.getItem('myCat', 'Secret Passphrase');
console.log(cat);// =>Tom
<script src="node_modules/crypto-js-storage/dist/build.js"></script>
<script>
const {AesStorage} = window.CryptoJsStorage;
AesStorage.setItem('myCat', 'Tom', 'Secret Passphrase');
const cat = AesStorage.getItem('myCat', 'Secret Passphrase');
console.log(cat);// =>Tom
</script>
Static Methods of the AES Storage
Method
Description
setItem(key: string, value: string, secret: string): void
Save Data to Local Storage.
copy
AesStorage.setItem('myCat', 'Tom', 'Secret Passphrase');
getItem(key: string, secret :string): string|null
Read Data from Local Storage.
copy
const cat = AesStorage.getItem('myCat', 'Secret Passphrase');
removeItem(key: string): void
Remove Data from Local Storage.
copy
AesStorage.removeItem('myCat');
clear(): void
Remove All (Clear Local Storage).
DES Storage
DES is a previously dominant algorithm for encryption, and was published as an official Federal Information Processing Standard (FIPS).
DES is now considered to be insecure due to the small key size.
copy
import {DesStorage} from 'crypto-js-storage';
DesStorage.setItem('myCat', 'Tom', 'Secret Passphrase');
const cat = DesStorage.getItem('myCat', 'Secret Passphrase');
console.log(cat);// =>Tom
<script src="node_modules/crypto-js-storage/dist/build.js"></script>
<script>
const {DesStorage} = window.CryptoJsStorage;
DesStorage.setItem('myCat', 'Tom', 'Secret Passphrase');
const cat = DesStorage.getItem('myCat', 'Secret Passphrase');
console.log(cat);// =>Tom
</script>
Static Methods of the DES Storage
Method
Description
setItem(key: string, value: string, secret: string): void
Save Data to Local Storage.
copy
DesStorage.setItem('myCat', 'Tom', 'Secret Passphrase');
getItem(key: string, secret :string): string|null
Read Data from Local Storage.
copy
const cat = DesStorage.getItem('myCat', 'Secret Passphrase');
removeItem(key: string): void
Remove Data from Local Storage.
copy
DesStorage.removeItem('myCat');
clear(): void
Remove All (Clear Local Storage).
Triple DES Storage
Triple DES applies DES three times to each block to increase the key size.
The algorithm is believed to be secure in this form.
copy
import {TripleDesStorage} from 'crypto-js-storage';
TripleDesStorage.setItem('myCat', 'Tom', 'Secret Passphrase');
const cat = TripleDesStorage.getItem('myCat', 'Secret Passphrase');
console.log(cat);// =>Tom
<script src="node_modules/crypto-js-storage/dist/build.js"></script>
<script>
const {TripleDesStorage} = window.CryptoJsStorage;
TripleDesStorage.setItem('myCat', 'Tom', 'Secret Passphrase');
const cat = TripleDesStorage.getItem('myCat', 'Secret Passphrase');
console.log(cat);// =>Tom
</script>
Static Methods of the Triple DES Storage
Method
Description
setItem(key: string, value: string, secret: string): void
Save Data to Local Storage.
copy
TripleDesStorage.setItem('myCat', 'Tom', 'Secret Passphrase');
getItem(key: string, secret :string): string|null
Read Data from Local Storage.
copy
const cat = TripleDesStorage.getItem('myCat', 'Secret Passphrase');
removeItem(key: string): void
Remove Data from Local Storage.
copy
TripleDesStorage.removeItem('myCat');
clear(): void
Remove All (Clear Local Storage).
copy
TripleDesStorage.clear();
Rabbit Storage
Rabbit is a high-performance stream cipher and a finalist in the eSTREAM Portfolio.
It is one of the four designs selected after a 3 1/2-year process where 22 designs were evaluated.
copy
import {RabbitStorage} from 'crypto-js-storage';
RabbitStorage.setItem('myCat', 'Tom', 'Secret Passphrase');
const cat = RabbitStorage.getItem('myCat', 'Secret Passphrase');
console.log(cat);// =>Tom
<script src="node_modules/crypto-js-storage/dist/build.js"></script>
<script>
const {RabbitStorage} = window.CryptoJsStorage;
RabbitStorage.setItem('myCat', 'Tom', 'Secret Passphrase');
const cat = RabbitStorage.getItem('myCat', 'Secret Passphrase');
console.log(cat);// =>Tom
</script>
Static Methods of the Rabbit Storage
Method
Description
setItem(key: string, value: string, secret: string): void
Save Data to Local Storage.
copy
RabbitStorage.setItem('myCat', 'Tom', 'Secret Passphrase');
getItem(key: string, secret :string): string|null
Read Data from Local Storage.
copy
const cat = RabbitStorage.getItem('myCat', 'Secret Passphrase');
removeItem(key: string): void
Remove Data from Local Storage.
copy
RabbitStorage.removeItem('myCat');
clear(): void
Remove All (Clear Local Storage).
RC4 Storage
RC4 is a widely-used stream cipher.
It's used in popular protocols such as SSL and WEP.
Although remarkable for its simplicity and speed, the algorithm's history doesn't inspire confidence in its security.
copy
import {RC4Storage} from 'crypto-js-storage';
RC4Storage.setItem('myCat', 'Tom', 'Secret Passphrase');
const cat = RC4Storage.getItem('myCat', 'Secret Passphrase');
console.log(cat);// =>Tom
<script src="node_modules/crypto-js-storage/dist/build.js"></script>
<script>
const {RC4Storage} = window.CryptoJsStorage;
RC4Storage.setItem('myCat', 'Tom', 'Secret Passphrase');
const cat = RC4Storage.getItem('myCat', 'Secret Passphrase');
console.log(cat);// =>Tom
</script>
Static Methods of the RC4 Storage
Method
Description
setItem(key: string, value: string, secret: string): void
Save Data to Local Storage.
copy
RC4Storage.setItem('myCat', 'Tom', 'Secret Passphrase');
getItem(key: string, secret :string): string|null
Read Data from Local Storage.
copy
const cat = RC4Storage.getItem('myCat', 'Secret Passphrase');
removeItem(key: string): void
Remove Data from Local Storage.
copy
RC4Storage.removeItem('myCat');
clear(): void
Remove All (Clear Local Storage).