MCPcopy Index your code
hub / github.com/XanderYe/dnf / encrypt

Method encrypt

algorithm/TeaEncrypt.java:57–71  ·  view source on GitHub ↗
(String v)

Source from the content-addressed store, hash-verified

55 }
56
57 private static String encrypt(String v) {
58 int v0 = strToInt(v);
59 int v1 = strToInt(v.substring(4));
60 int sum = 0;
61 for (int i = 0; i < 32; i++) {
62 int tv1 = (v1 << 4) ^ (v1 >> 5 & 0x07FFFFFF);
63 int tv2 = unpack(KEY, (sum & 3) * 4);
64 v0 = v0 + ((tv1 + v1) ^ (tv2 + sum));
65 sum = sum + 0x9E3779B9;
66 tv1 = (((v0 << 4)) ^ ((v0 >> 5 & 0x07FFFFFF)));
67 tv2 = unpack(KEY, ((sum >> 11) & 3) * 4);
68 v1 = (v1 + ((tv1 + v0) ^ (tv2 + sum)));
69 }
70 return intToStr(v0) + intToStr(v1);
71 }
72
73 public static void main(String[] args) {
74 String password = "uu5!^%jg";

Callers 1

getKeyMethod · 0.95

Calls 3

strToIntMethod · 0.95
unpackMethod · 0.95
intToStrMethod · 0.95

Tested by

no test coverage detected