

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 7
click for more info
Not enough gems
Cost: 6 gems
1: Block Ciphers
incomplete
2: Block vs. Stream
incomplete
3: Block Sizes
incomplete
4: Chunks Review
incomplete
5: Key Schedules
incomplete
6: Key Schedule Review
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
A block cipher is a deterministic algorithm that operates on fixed-length groups of data, called blocks. Like stream ciphers, block ciphers are a kind of symmetric encryption.
Block ciphers are widely used in real-world applications to encrypt large amounts of data.
The Go standard library has built-in support for the AES and DES block ciphers, which we will talk about in more detail later.
We've been asked by leadership to check on the block sizes of each algorithm and report back. Complete the getBlockSize function.
func getBlockSize(keyLen, cipherType int) (int, error)
This function accepts a keyLen and cipherType and returns the block size of the cipher along with any errors encountered.
The cipherType is an enum of typeAES or typeDES. Depending on the cipher type, create a new cipher using:
The value of the key passed in doesn't matter here, all that matters is its length.
invalid cipher type error if the cipherType isn't one of the valid values.