Advertisement
Guest User

CodeBreaker.java

a guest
Nov 17th, 2013
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.07 KB | None | 0 0
  1. /**
  2.  * Brute forces a shift cipher by displaying all 25 possible substitutions.
  3.  *
  4.  * @file CodeBreaker.java
  5.  * @author oz <oz@freqlabs.com>
  6.  * @date 2012-11-17
  7.  */
  8.  
  9. /*
  10. Copyright 2013 Freq Labs
  11.  
  12. Licensed under the Apache License, Version 2.0 (the "License");
  13. you may not use this file except in compliance with the License.
  14. You may obtain a copy of the License at
  15.  
  16.     http://www.apache.org/licenses/LICENSE-2.0
  17.  
  18. Unless required by applicable law or agreed to in writing, software
  19. distributed under the License is distributed on an "AS IS" BASIS,
  20. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  21. See the License for the specific language governing permissions and
  22. limitations under the License.
  23. */
  24.  
  25. public class CodeBreaker
  26. {
  27.     public static void main(String[] args)
  28.     {
  29.         String ciphertext = "KZINVXJGV";
  30.         StringShifter shifter = new StringShifter(ciphertext);
  31.  
  32.         for (int n = 1; n < 26; ++n)
  33.         {
  34.             String plaintext = shifter.shift(n);
  35.  
  36.             System.out.println(plaintext);
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement