Rijndael, commonly referred to as the Advanced Encryption Standard (AES), is a specification for encrypting data. Solve the challenge to implement this cipher and pass tests.
Create your encrypt function in app.js under encrypt
.
This function will be called from the test cases with the following parameters;
byte
- The data to encrypt as an array of bytes.
key
- The key to use for the encryption, as an array of bytes. The function should return the encrypted data as an array of bytes.
# | Key input | Data input | Expected output |
---|---|---|---|
1 | 2b7e151628aed2a6abf7158809cf4f3c | 3243f6a8885a308d313198a2e0370734 | 3925841d02dc09fbdc118597196a0b32 |
2 | 2b7e151628aed2a6abf7158809cf4f3c762e7160f38b4da5 | 3243f6a8885a308d313198a2e0370734 | f9fb29aefc384a250340d833b87ebc00 |
3 | 2b7e151628aed2a6abf7158809cf4f3c762e7160f38b4da56a784d9045190cfe | 3243f6a8885a308d313198a2e0370734 | 1a6e6c2c662e7da6501ffb62bc9e93f3 |
Create your decrypt function in app.js under decrypt
.
This function will be called from the test cases with the following parameters;
byte
- The data to decrypt as an array of bytes.
key
- The key to use for the decryption, as an array of bytes.
The function should return the decrypted data as an array of bytes.
# | Key input | Data input | Expected output |
---|---|---|---|
1 | 2b7e151628aed2a6abf7158809cf4f3c | 3925841d02dc09fbdc118597196a0b32 | 3243f6a8885a308d313198a2e0370734 |
2 | 2b7e151628aed2a6abf7158809cf4f3c762e7160f38b4da5 | f9fb29aefc384a250340d833b87ebc00 | 3243f6a8885a308d313198a2e0370734 |
3 | 2b7e151628aed2a6abf7158809cf4f3c762e7160f38b4da56a784d9045190cfe | 1a6e6c2c662e7da6501ffb62bc9e93f3 | 3243f6a8885a308d313198a2e0370734 |
- The data passed will be a single block.
- There will be 3 different sizes of keys passed.
- 128
- 192
- 256
- The cipher mode will always be ECB
- It is allowed to use packages or build-in functionality for this, which means writing your own cipher code is optional.
codecheck: Finish with code 9
codecheck: tests : 9
codecheck: success: 0
codecheck: failure: 9
codecheck: Finish with code 0
codecheck: tests : 9
codecheck: success: 9
codecheck: failure: 0
To run tests locally install codecheck
by running the following command in terminal
$ npm install codecheck -g
To run tests in web editor please click in RUN
button on left side of web editor
In answer.md write a brief explanation
- About how your code works
- Problems faced while solving the challenge
- How you solved those problems
- Improvements/Feedbacks are also welcomed