MCPcopy Index your code
hub / github.com/BombusMod/BombusMod / calcVerHash

Method calcVerHash

src/main/java/xmpp/EntityCaps.java:87–113  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

85 public static String ver = null;
86
87 public static String calcVerHash() throws Exception {
88 if (ver != null) {
89 return ver;
90 }
91 int j = features.size();
92 if (j < 1) {
93 initCaps();
94 }
95
96 MessageDigest sha1 = MessageDigest.getInstance("SHA-1");
97
98 //indentity
99 StringBuffer identity = new StringBuffer();
100 identity.append(BOMBUS_ID_CATEGORY).append("/").append(BOMBUS_ID_TYPE)
101 .append("//").append(StaticData.getInstance().getVersionInfo().getName()).append("<");
102
103 for (int i = 0; i < j; i++) {
104 identity.append((String) features.elementAt(i));
105 identity.append("<");
106 }
107 sha1.update(identity.toString().getBytes(), 0, identity.length());
108 byte[] sha1bits = new byte[20];
109 sha1.digest(sha1bits, 0, sha1bits.length);
110 ver = Strconv.toBase64(sha1bits, sha1bits.length);
111
112 return ver;
113 }
114
115 public static JabberDataBlock presenceEntityCaps() {
116 try {

Callers 3

blockArrivedMethod · 0.95
presenceEntityCapsMethod · 0.95
cmdOkMethod · 0.80

Calls 10

initCapsMethod · 0.95
getInstanceMethod · 0.95
toBase64Method · 0.95
appendMethod · 0.80
getVersionInfoMethod · 0.80
getNameMethod · 0.65
sizeMethod · 0.45
getInstanceMethod · 0.45
getBytesMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected