CryptoHelper

open class CryptoHelper

Author

lngtr

Since

2018-02-24

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

Functions

Link copied to clipboard
open fun crcHash(input: Array<Byte>): Array<Byte>
Performs CRC32 on an input byte array using the CrcStandard.
Link copied to clipboard
open fun generateRandomBlock(size: Int): Array<Byte>
Generate an array of random bytes given the input length
Link copied to clipboard
open fun shaHash(input: Array<Byte>): Array<Byte>
Link copied to clipboard
open fun symmetricDecrypt(input: Array<Byte>, key: Array<Byte>): Array<Byte>
open fun symmetricDecrypt(input: Array<Byte>, key: Array<Byte>, iv: Passable<Array<Byte>>): Array<Byte>
Decrypts using AES/CBC/PKCS7 with an input byte array and key, using the random IV prepended using AES/ECB/None
Link copied to clipboard
open fun symmetricDecryptHMACIV(input: Array<Byte>, key: Array<Byte>, hmacSecret: Array<Byte>): Array<Byte>
Decrypts using AES/CBC/PKCS7 with an input byte array and key, using the IV (comprised of random bytes and the HMAC-SHA1 of the random bytes and plaintext) prepended using AES/ECB/None
Link copied to clipboard
open fun symmetricEncrypt(input: Array<Byte>, key: Array<Byte>): Array<Byte>
Performs an encryption using AES/CBC/PKCS7 with an input byte array and key, with a random IV prepended using AES/ECB/None
Link copied to clipboard
open fun symmetricEncryptWithHMACIV(input: Array<Byte>, key: Array<Byte>, hmacSecret: Array<Byte>): Array<Byte>
Performs an encryption using AES/CBC/PKCS7 with an input byte array and key, with a IV (comprised of random bytes and the HMAC-SHA1 of the random bytes and plaintext) prepended using AES/ECB/None
Link copied to clipboard
open fun symmetricEncryptWithIV(input: Array<Byte>, key: Array<Byte>, iv: Array<Byte>): Array<Byte>
Performs an encryption using AES/CBC/PKCS7 with an input byte array and key, with a random IV prepended using AES/ECB/None