001    package railo.commons.lang;
002    
003    import java.io.IOException;
004    
005    
006    public class KeyGenerator {
007            public static String createKey(String value) throws IOException{
008                    // create a crossfoot of the string and change result in constealltion of the position
009                    long sum=0;
010                    for(int i=value.length()-1;i>=0;i--){
011                            sum+=(value.charAt(i))*((i%3+1)/2f);
012                    }
013                    return Md5.getDigestAsString(value)+":"+sum;
014            }
015            public static String createVariable(String value) throws IOException{
016                    // create a crossfoot of the string and change result in constealltion of the position
017                    long sum=0;
018                    for(int i=value.length()-1;i>=0;i--){
019                            sum+=(value.charAt(i))*((i%3+1)/2f);
020                    }
021                    return "V"+Md5.getDigestAsString(value)+sum;
022            }
023    }