-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSymCipher.java
More file actions
18 lines (16 loc) · 788 Bytes
/
SymCipher.java
File metadata and controls
18 lines (16 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/** Interface for symmetric ciphers to be used with Assignment 4.
* This must be implemented by both your Add128 and Substitute classes.
* Adapted from Dr. John Ramirez's CS 1501 Assignment 4
*/
public interface SymCipher
{
// Return an array of bytes that represent the key for the cipher
public byte [] getKey();
// Encode the string using the key and return the result as an array of
// bytes. Note that you will need to convert the String to an array of bytes
// prior to encrypting it. Also note that String S could have an arbitrary
// length, so your cipher may have to "wrap" when encrypting.
public byte [] encode(String S);
// Decrypt the array of bytes and generate and return the corresponding String.
public String decode(byte [] bytes);
}