public static String getKeyFromLock(String item) throws IOException{
                String lock = sanitizeKey(item,1);
                int len = lock.length();

                //computing the key
                String key  = ""+(char)(lock.charAt(0) ^ lock.charAt(len-1) ^ lock.charAt(len-2) ^ 5);
                for (int i = 1; i < len; i++){
                        key += lock.charAt(i) ^ lock.charAt(i-1);
                }
                char[] newchars = new char[len];
                for (int i = 0; i < len; i++){
                        char x = (char)((key.charAt(i) >> 4) & 0x0F0F0F0F);
                        char y = (char)((key.charAt(i) & 0x0F0F0F0F) << 4);
                        newchars[i] = (char)(x | y);
                }
                key = sanitizeKey(String.valueOf(newchars),0);
                return key;
        }