Changeset 14366


Ignore:
Timestamp:
08/14/07 12:36:54 (13 years ago)
Author:
qq6
Message:

encrypt or decrypt the password using rot-13

File:
1 edited

Legend:

Unmodified
Added
Removed
  • greenstone3/trunk/src/java/org/greenstone/gsdl3/util/DerbyWrapper.java

    r14348 r14366  
    234234        String returned_groups=rs.getString("groups");
    235235        System.out.println("<groups>" + returned_groups);
    236         String returned_password=rs.getString("password");
     236        String returned_password=rot13(rs.getString("password"));
    237237        System.out.println("<password>" + returned_password);
    238238        System.out.println("<username>" + returned_username);
     
    252252        }
    253253    }
     254
     255    //Simply use rot-13 to encrypt and decrypt the password
     256    public String rot13(String password){
     257    String out_password="";
     258     for (int i = 0; i < password.length(); i++) {
     259            char c = password.charAt(i);
     260            if       (c >= 'a' && c <= 'm') c += 13;
     261            else if  (c >= 'n' && c <= 'z') c -= 13;
     262            else if  (c >= 'A' && c <= 'M') c += 13;
     263            else if  (c >= 'A' && c <= 'Z') c -= 13;
     264            out_password+=c;
     265        }
     266     return out_password;
     267    }
    254268}
Note: See TracChangeset for help on using the changeset viewer.