| about | help | code help+videos | done | prefs | 
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
apcsaEncryptIntToChar   apcsaEncryptToAlphaNums
apcsaEncryptToAlphaNums   apcsaDecryptFromAlphaNums
apcsaDecryptFromAlphaNums  
MEDIUM:  apcsaAtbashCipher
apcsaAtbashCipher   apcsaEncryptSubstitutionKey
apcsaEncryptSubstitutionKey   apcsaEncryptHomophonicCipher
apcsaEncryptHomophonicCipher   apcsaDecryptHomophonicCipher
apcsaDecryptHomophonicCipher 
Code word lists
EASY:  apcsaFindFirstCodeword
apcsaFindFirstCodeword 
MEDIUM:  apcsaExtractHiddenWords
apcsaExtractHiddenWords   apcsaExtractHiddenWordsWhole
apcsaExtractHiddenWordsWhole   apcsaExcludeHiddenWords
apcsaExcludeHiddenWords 
HARD:  apcsaExcludeHiddenWordsHard
apcsaExcludeHiddenWordsHard   apcsaDecryptRotateSort
apcsaDecryptRotateSort 
Anagrams
EASY:  apcsaIsAnagram
apcsaIsAnagram 
MEDIUM:  apcsaCountAnagrams
apcsaCountAnagrams   apcsaIndexOfAnagram
apcsaIndexOfAnagram  
HARD:  apcsaFindStretchedAnagrams
apcsaFindStretchedAnagrams 
One-dimensional transposition
EASY:  apcsaEncryptRotatePositions
apcsaEncryptRotatePositions 
MEDIUM:  apcsaEncryptPairSwap
apcsaEncryptPairSwap   apcsaEncryptMod
apcsaEncryptMod   apcsaDecryptMod
apcsaDecryptMod   apcsaEncryptRotateEvens
apcsaEncryptRotateEvens   apcsaEncryptRearrangeWords
apcsaEncryptRearrangeWords   apcsaDecryptRearrangeWords
apcsaDecryptRearrangeWords   apcsaEncryptCycleBits
apcsaEncryptCycleBits 
Math-based substitution
These problems start easy, but the last two are really hard.
EASY:  apcsaEncryptCaesarChar
apcsaEncryptCaesarChar   apcsaEncryptCaesarString
apcsaEncryptCaesarString   apcsaEncryptCaesarCharKey
apcsaEncryptCaesarCharKey   apcsaEncryptCaesarStringKey
apcsaEncryptCaesarStringKey   apcsaEncryptCaesarStringPassword
apcsaEncryptCaesarStringPassword  
MEDIUM:  apcsaEncryptDifferences
apcsaEncryptDifferences   apcsaDecryptDifferences
apcsaDecryptDifferences   apcsaEncryptXor
apcsaEncryptXor   apcsaDecryptXor
apcsaDecryptXor  
HARD:  apcsaEncryptSumModulus
apcsaEncryptSumModulus   apcsaDecryptSumModulusWithHint
apcsaDecryptSumModulusWithHint 
Two-dimensional transposition
Warning, these can be challenging.
HARD:  apcsaEncryptRailFence
apcsaEncryptRailFence   apcsaDecryptRailFence
apcsaDecryptRailFence   apcsaEncryptColumnarCipher
apcsaEncryptColumnarCipher   apcsaDecryptColumnarCipher
apcsaDecryptColumnarCipher 
Tools used to break substitution ciphers
MEDIUM:  apcsaEncryptHighestFrequency
apcsaEncryptHighestFrequency   apcsaMostCommonWord
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
apcsaHashSumLetters   apcsaHashSumString
apcsaHashSumString  
MEDIUM:  apcsaHashArraySumString
apcsaHashArraySumString   apcsaHashCaesarString
apcsaHashCaesarString   apcsaHashStringToArray
apcsaHashStringToArray   apcsaHashStringCollisions
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
apcsaEncryptStringToBlocks  
HARD:  apcsaEncryptCoprimes
apcsaEncryptCoprimes   apcsaEncryptPublicKey
apcsaEncryptPublicKey   apcsaEncryptBruteForceAttack
apcsaEncryptBruteForceAttack   apcsaEncryptPublicKeyBlocks
apcsaEncryptPublicKeyBlocks   apcsaEncryptFindPrivateKey
apcsaEncryptFindPrivateKey   apcsaDecryptPublicKeyChars
apcsaDecryptPublicKeyChars 
Authoring docs
Copyright Nick Parlante 2017 - privacy