id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

orion.a.smith@gmail.com apcsa-encryption

Description:Encryption-based problems with String data

These methods represent ways to encrypt or decrypt text, either using the String methods or by considering characters individually. Many of these problems will require knowledge of arrays and ArrayLists, and some near the end use specialized Java classes which they will introduce to you.

Some other very handy bits to know how to use: Character.isLetter, Character.isDigit, Character.isUpperCase, Character.isLowerCase, Math.max, Math.min, Math.ceil, Math.floor, and a really solid understanding of the remainder operator (%). Also typecasting back and forth between char and int. You can turn a String s into an array of chars using s.toCharArray(), and you can construct a String from a char array called chars with new String(chars).

--------------------------------------

Section 1: Pre-digital encryption schemes
--------------------------------------

Algorithms in this section represent some of the basic, even trivial encryption schemes that have been used for hundreds of years. Most of these are based on substitution and transposition ciphers, although many classical schemes also involve simple, reversible math with characters or groups of characters.

Substitution by letter or keys

These range from easy to moderate.

EASY: apcsaEncryptIntToChar  apcsaEncryptToAlphaNums  apcsaDecryptFromAlphaNums 

MEDIUM: apcsaAtbashCipher  apcsaEncryptSubstitutionKey  apcsaEncryptHomophonicCipher  apcsaDecryptHomophonicCipher 

Code word lists

EASY: apcsaFindFirstCodeword 

MEDIUM: apcsaExtractHiddenWords  apcsaExtractHiddenWordsWhole  apcsaExcludeHiddenWords 

HARD: apcsaExcludeHiddenWordsHard  apcsaDecryptRotateSort 

Anagrams

EASY: apcsaIsAnagram 

MEDIUM: apcsaCountAnagrams  apcsaIndexOfAnagram 

HARD: apcsaFindStretchedAnagrams 

One-dimensional transposition

EASY: apcsaEncryptRotatePositions 

MEDIUM: apcsaEncryptPairSwap  apcsaEncryptMod  apcsaDecryptMod  apcsaEncryptRotateEvens  apcsaEncryptRearrangeWords  apcsaDecryptRearrangeWords  apcsaEncryptCycleBits 

Math-based substitution

These problems start easy, but the last two are really hard.

EASY: apcsaEncryptCaesarChar  apcsaEncryptCaesarString  apcsaEncryptCaesarCharKey  apcsaEncryptCaesarStringKey  apcsaEncryptCaesarStringPassword 

MEDIUM: apcsaEncryptDifferences  apcsaDecryptDifferences  apcsaEncryptXor  apcsaDecryptXor 

HARD: apcsaEncryptSumModulus  apcsaDecryptSumModulusWithHint 

Two-dimensional transposition

Warning, these can be challenging.

HARD: apcsaEncryptRailFence  apcsaDecryptRailFence  apcsaEncryptColumnarCipher  apcsaDecryptColumnarCipher 

Tools used to break substitution ciphers

MEDIUM: apcsaEncryptHighestFrequency  apcsaMostCommonWord 

--------------------------------------

Section 2: Modern encryption-adjacent tools
--------------------------------------

Hashing algorithms

These algorithms are basic introductions to hashing, which converts a large amount of data into a smaller, often fixed amount of data. Hashing is not encryption because it is not (should not be) a reversible process. But, it's frequently used for verification of data including sensitive data such as passwords. These problems will hopefully improve your ability to consider characters as numbers in a variety of ways.

EASY: apcsaHashSumLetters 

MEDIUM: apcsaHashSumString  apcsaHashArraySumString  apcsaHashCaesarString  apcsaHashStringToArray  apcsaHashStringCollisions 

--------------------------------------

Section 3: Public key encryption
--------------------------------------

Public key encryption is the way modern cryptography secures communication through mathematics. While the numbers you will be dealing with are manageable, the techniques developed here are completely real and could be used with only minor modifications to provide strong security. These problems are pretty tough and come with a lot of explanation. The code to complete them isn't long, but understanding what you are doing (and why) can be challenging.

MEDIUM: apcsaEncryptStringToBlocks 

HARD: apcsaEncryptCoprimes  apcsaEncryptPublicKey  apcsaEncryptBruteForceAttack  apcsaEncryptPublicKeyBlocks  apcsaEncryptFindPrivateKey  apcsaDecryptPublicKeyChars 
Authoring docs

Copyright Nick Parlante 2017 - privacy