I have a piece of encrypted text and the clear text. Do any open source tools (with sourcecode) exist that can help determine the type of cipher and the key? (Operating system or language is irrelevant.)
Detection and identification
While it is possible to identify a cryptographic algorithm by way of cipher bit sequences, you should know that it can be difficult and (more important) reverse-engineering protection mechanisms like encryption may be illegal in your country.
Assuming your country does not uphold any related restrictions, and depending the individual data available to you, one or more of the following open-source tools may or may not be appropriate:
- Draft Crypto Analyzer – DRACA
- Hash & Crypto Detector – HCD
- IDA Pro with the Findcrypt plugin
- PEiD with the Krypto Analyzer (KANAL) plugin
- OllyDbg with the SnD Crypto Scanner
- x3chun's Crypto Searcher
Tip: Check for classic cipher algorithms first!
It may very well be that you are looking at the output of one of the classic cryptographic algorithms. Therefore, my personal tip would be to start out by trying to check if you’re dealing with ciphertext from a simple transposition cipher, or something smarter. See, simple transposition ciphers are easier to analyze and (if not applicable) to exclude. Analyzing for potential monogram frequencies can provide good hints and tools like this online calculator combined with tables like this one may already suffice.
As crypto algorithm identification is part of cryptanalysis and a very broad area, you might also want to read papers like “Block cipher identification using support vector classification and regression” which may help understand why it can be difficult and (in a worst case scenario) offer endless options.