net.sourceforge.plantuml.eggs.SentenceDecoder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of plantuml-mit Show documentation
Show all versions of plantuml-mit Show documentation
PlantUML is a component that allows to quickly write diagrams from text.
// THIS FILE HAS BEEN GENERATED BY A PREPROCESSOR.
package net.sourceforge.plantuml.eggs;
import static java.nio.charset.StandardCharsets.UTF_8;
import java.io.UnsupportedEncodingException;
public class SentenceDecoder {
// ::remove file when __CORE__
private final String secret;
public SentenceDecoder(String sentence1, byte[] crypted) throws UnsupportedEncodingException {
final byte[] key = EggUtils.fromSecretSentence(sentence1).toByteArray();
final byte[] sen2 = EggUtils.xor(crypted, key);
this.secret = new String(sen2, UTF_8);
}
public boolean isOk() {
for (char c : secret.toCharArray()) {
if ((int) c > 256) {
return false;
}
if (Character.isDefined(c) == false) {
return false;
}
if (Character.isISOControl(c)) {
return false;
}
}
return true;
}
public String getSecret() {
return secret;
}
}