jumpeiymn / codecheck-1904

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rijndael

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.

Challenge Description

Step 1: Encryption

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.

Encrypt

# Key input Data input Expected output
1 2b7e151628aed2a6abf7158809cf4f3c 3243f6a8885a308d313198a2e0370734 3925841d02dc09fbdc118597196a0b32
2 2b7e151628aed2a6abf7158809cf4f3c762e7160f38b4da5 3243f6a8885a308d313198a2e0370734 f9fb29aefc384a250340d833b87ebc00
3 2b7e151628aed2a6abf7158809cf4f3c762e7160f38b4da56a784d9045190cfe 3243f6a8885a308d313198a2e0370734 1a6e6c2c662e7da6501ffb62bc9e93f3

Step 2: Decryption

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.

Decrypt

# Key input Data input Expected output
1 2b7e151628aed2a6abf7158809cf4f3c 3925841d02dc09fbdc118597196a0b32 3243f6a8885a308d313198a2e0370734
2 2b7e151628aed2a6abf7158809cf4f3c762e7160f38b4da5 f9fb29aefc384a250340d833b87ebc00 3243f6a8885a308d313198a2e0370734
3 2b7e151628aed2a6abf7158809cf4f3c762e7160f38b4da56a784d9045190cfe 1a6e6c2c662e7da6501ffb62bc9e93f3 3243f6a8885a308d313198a2e0370734

Note

  • 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.

Test Results before solving the challenge

codecheck: Finish with code 9
codecheck: tests  : 9
codecheck: success: 0
codecheck: failure: 9

Test Results after solving the challenge

codecheck: Finish with code 0
codecheck: tests  : 9
codecheck: success: 9
codecheck: failure: 0

Run Tests

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

Explain your code

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

References

About


Languages

Language:JavaScript 100.0%