Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;

public class Main {
    public static void main(String[] argv) throws Exception {
        // Generate a DES key
        KeyGenerator keyGen = KeyGenerator.getInstance("DES");
        SecretKey key = keyGen.generateKey();

        // Generate a Blowfish key
        keyGen = KeyGenerator.getInstance("Blowfish");
        key = keyGen.generateKey();

        // Generate a triple DES key
        keyGen = KeyGenerator.getInstance("DESede");
        key = keyGen.generateKey();
    }
}