Java String Descrypt decryptMailAdress(String enc, int offset)

Here you can find the source of decryptMailAdress(String enc, int offset)

Description

decrypt Mail Adress

License

Open Source License

Declaration

private static String decryptMailAdress(String enc, int offset) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    private static String decryptMailAdress(String enc, int offset) {
        String dec = "";
        int len = enc.length();
        for (int i = 0; i < len; i++) {
            char n = enc.charAt(i);
            if (n >= 0x2B && n <= 0x3A) {
                dec += decryptCharcode(n, 0x2B, 0x3A, offset);
            } else if (n >= 0x40 && n <= 0x5A) {
                dec += decryptCharcode(n, 0x40, 0x5A, offset);
            } else if (n >= 0x61 && n <= 0x7A) {
                dec += decryptCharcode(n, 0x61, 0x7A, offset);
            } else {
                dec += enc.charAt(i);//from w  ww  . j  a v  a 2 s  .  c  o m
            }
        }
        return dec;
    }

    private static char decryptCharcode(char c, int start, int end, int offset) {
        int n = (int) c;
        n = n + offset;
        if (offset > 0 && n > end) {
            n = start + (n - end - 1);
        } else if (offset < 0 && n < start) {
            n = end - (start - n - 1);
        }
        return (char) n;
    }
}

Related

  1. decryptBytes(final byte[] b, final int i)
  2. decryptChar(String pwd, int offset, int pos)
  3. decryptCharcode(char c, int start, int end, int offset)
  4. decryptEmailId(String encryptedEmailId)
  5. decryptL(byte[] bytes, int length)
  6. decryptPwd(String enc)