All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.wiztools.commons.Rot13 Maven / Gradle / Ivy

/*
 * Copyright WizTools.org
 * Licensed under the Apache License, Version 2.0:
 * http://www.apache.org/licenses/LICENSE-2.0
 */
package org.wiztools.commons;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

/**
 * An implementation of the ROT-13 algorithm. The lookup table is defined as a
 * constant in the code: making this implementation pretty fast.
 * @author subhash
 */
public final class Rot13 {

    private static final Map map;
    static {
        final char[] lookup1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".toCharArray();
        final char[] lookup2 = "NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm".toCharArray();

        Map m = new HashMap();
        for(int i=0; i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy