sscii解密

@param code {@link String}
@param key {@link String}

@return {@link String}
357614
public static String ascii(String code, String key) {
        return ascii(code, CryptUtils.stringToKey(key));
    }
573067
public static KeyStroke getKeyStroke(String key) throws NoSuchElementException
	{
		key = key.toUpperCase();
		int _sep = key.indexOf("/");
		String _mask = key.substring(0, _sep);
		String _keyCode = key.substring(_sep + 1);
		Integer _m = theMaskTable.get(_mask);
		Integer _t = theKeyTable.get(_keyCode);
		if (null == _m || null == _t)
		{
			throw new NoSuchElementException(key);
		}
		return (KeyStroke.getKeyStroke(_t.intValue(), _m.intValue()));
	}
516139
private boolean dumpKey(final byte[] key) throws Exception {
    byte[] encoded = Base64.encodeBase64Chunked(key);
    String encText = new String(encoded);

    System.out.println("Copy the text between the delimiters");
    System.out.println("Take all below this line ----------------------->");
    System.out.println(encText);
    System.out.println("<--------------- up to and not including this line");

    // See if it decodes
    byte[] decoded = Base64.encodeBase64Chunked(encText.getBytes());

    if (decoded.length != key.length) {
      error("Validity check failed: lengths not equal " +
           "(decoded=" + decoded.length + " key=" + key.length + ")");
      dumpHex(decoded);
      error(" ");
      dumpHex(key);
      return false;
    }

    for (int i = 0; i < decoded.length; i++) {
      if (decoded[i] != key[i]) {
        error("Validity check failed: byte at position " + i + " not equal");
        dumpHex(decoded);
        error(" ");
        dumpHex(key);

        return false;
      }
    }

    return true;
  }
236057
@Override
  public String header(String key)
  {
    CharSegment buf = getHeaderBuffer(key);
    
    if (buf != null)
      return buf.toString();
    else
      return null;
  }
835593
public int getIntHeader(String key)
  {
    CharSegment value = getHeaderBuffer(key);

    if (value == null)
      return -1;

    int len = value.length();
    if (len == 0)
      throw new NumberFormatException(value.toString());

    int iValue = 0;
    int i = 0;
    int ch = value.charAt(i);
    int sign = 1;
    if (ch == '+') {
      if (i + 1 < len)
        ch = value.charAt(++i);
      else
        throw new NumberFormatException(value.toString());
    } else if (ch == '-') {
      sign = -1;
      if (i + 1 < len)
        ch = value.charAt(++i);
      else
        throw new NumberFormatException(value.toString());
    }

    for (; i < len && (ch = value.charAt(i)) >= '0' && ch <= '9'; i++)
      iValue = 10 * iValue + ch - '0';

    if (i < len)
      throw new NumberFormatException(value.toString());

    return sign * iValue;
  }
924091
public static String hmacSHA256(String data, String key) {
        return hmacSHA256(data.getBytes(), key.getBytes());
    }
36406
private static void encodeKey(ByteBuf buf, byte[] key) {
        if (key == null || key.length == 0) {
            return;
        }

        buf.writeBytes(key);
    }
369831
def object2code(key, code):
    """"""

    if key in ["xscale", "yscale"]:
        if code == "log":
            code = True
        else:
            code = False

    else:
        code = unicode(code)

    return code
585954
def code_to_sjis(code):
    """
    if code and isinstance(code, basestring):
        clean_code = code.replace('>', '')
        if clean_code:
            _code_to_sjis_char = lambda c: ''.join([chr(int("%c%c"%(a, b), 16)) for a, b in izip(c[0::2], c[1::2])])
            return ''.join([_code_to_sjis_char(code_char) for code_char in clean_code.split('+') if code_char])
    return None
42244
@SuppressWarnings("rawtypes")
    public static String createSign(String key, Map<String, Object> params) {
        SortedMap<Object, Object> parameters = new TreeMap<Object, Object>();
        Set es = params.entrySet();
        Iterator it = es.iterator();
        while (it.hasNext()) {
            Map.Entry entry = (Map.Entry) it.next();
            String k = (String) entry.getKey();
            Object v = entry.getValue();
            parameters.put(k, v);
        }
        StringBuffer sb = new StringBuffer();
        Set es2 = parameters.entrySet();//accsii升序排序
        Iterator it2 = es2.iterator();
        while (it2.hasNext()) {
            Map.Entry entry = (Map.Entry) it2.next();
            String k = (String) entry.getKey();
            Object v = entry.getValue();
            if (null != v && !"".equals(v)
                    && !"sign".equals(k) && !"key".equals(k)) {
                sb.append(k + "=" + v + "&");
            }
        }
        sb.append("key=" + key);
        String sign = Lang.md5(sb.toString()).toUpperCase();
        return sign;
    }
445370
public boolean hasTemplate(String key)
	{
		Program program = (Program) this.programCache.get(key);
		return program != null;
	}
941313
private static int decodeBase31(@Nonnull final String code) {
        int value = 0;
        for (final char c : code.toCharArray()) {
            if (c == '.') {
                return value;
            }
            if (DECODE_CHARS[c] < 0) {
                return -1;
            }
            value = (value * 31) + DECODE_CHARS[c];
        }
        return value;
    }
1129238
protected void writeUTF(int code, String string)
        throws IOException
    {
        OutputStream os = getOutputStream();

        os.write(code);

        int charLength = string.length();

        int length = 0;
        for (int i = 0; i < charLength; i++) {
            char ch = string.charAt(i);

            if (ch < 0x80)
                length++;
            else if (ch < 0x800)
                length += 2;
            else
                length += 3;
        }

        os.write(length >> 8);
        os.write(length);

        for (int i = 0; i < length; i++) {
            char ch = string.charAt(i);

            if (ch < 0x80)
                os.write(ch);
            else if (ch < 0x800) {
                os.write(0xc0 + (ch >> 6) & 0x1f);
                os.write(0x80 + (ch & 0x3f));
            }
            else {
                os.write(0xe0 + (ch >> 12) & 0xf);
                os.write(0x80 + ((ch >> 6) & 0x3f));
                os.write(0x80 + (ch & 0x3f));
            }
        }
    }
1204632
public static String escape(String s, JSONStyle compression) {
		if (s == null)
			return null;
		StringBuilder sb = new StringBuilder();
		compression.escape(s, sb);
		return sb.toString();
	}
1312481
public boolean isCodeInCC(Encoding enc, int code) {
        int len;
        if (enc.minLength() > 1) {
            len = 2;
        } else {
            len = enc.codeToMbcLength(code);
        }
        return isCodeInCCLength(len, code);
    }
890538
protected byte[] keyToBytes(String key) throws Exception {
		int i = key.indexOf(':');

		byte[] part1;
		byte[] part2;
		boolean compressed;

		if (i == -1) {
			part1 = key.getBytes(StandardCharsets.UTF_8);
			part2 = new byte[0];
			compressed = false;
		} else {
			part1 = key.substring(0, i).getBytes(StandardCharsets.UTF_8);
			part2 = key.substring(i + 1).getBytes(StandardCharsets.UTF_8);
			if (compressAbove > 0 && part2.length > compressAbove) {
				part2 = compress(part2, compressionLevel);
				compressed = true;
			} else {
				compressed = false;
			}
		}

		// Write key packet
		ByteArrayOutputStream out = new ByteArrayOutputStream(part1.length + part2.length + 16);
		DataOutputStream dos = new DataOutputStream(out);
		dos.writeInt(part1.length);
		dos.write(part1);
		dos.writeInt(part2.length);
		dos.write(part2);
		dos.writeBoolean(compressed);
		dos.flush();

		// Return key as partly compressed bytes
		return out.toByteArray();
	}
776235
public int cacheIdx(String key) {
		int h = 0;
		for (int i = 0; i < key.length(); i++) {
		    h = 31*h + key.charAt(i);
		}
		if(h<0)h*=-1;
		return h%segSize;
	}