Skip to content

Commit

Permalink
- tested successfully z-presentation of yacy seed encoding
Browse files Browse the repository at this point in the history
- added alternative switch that takes shortest representation as yacy seed string encoding

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4491 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Feb 17, 2008
1 parent 22b8525 commit 36b898c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions source/de/anomic/tools/crypt.java
Expand Up @@ -129,4 +129,10 @@ public static String simpleDecode(String encoded, String key) {
}
}

public static void main(String[] args) {
String teststring="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
System.out.println("Teststring = " + teststring);
System.out.println("enc-b result = " + simpleDecode(simpleEncode(teststring, null, 'b'), null));
System.out.println("enc-z result = " + simpleDecode(simpleEncode(teststring, null, 'z'), null));
}
}
6 changes: 5 additions & 1 deletion source/de/anomic/yacy/yacySeed.java
Expand Up @@ -818,7 +818,11 @@ public final String toString() {

public final String genSeedStr(String key) {
// use a default encoding
return this.genSeedStr('z', key);
String z = this.genSeedStr('z', key);
String b = this.genSeedStr('b', key);
// the compressed string may be longer that the uncompressed if there is too much overhead for compression meta-info
// take simply that string that is shorter
if (b.length() < z.length()) return b; else return z;
}

public final synchronized String genSeedStr(char method, String key) {
Expand Down

0 comments on commit 36b898c

Please sign in to comment.