MCPcopy Create free account
hub / github.com/M66B/FairEmail / getAd

Method getAd

app/src/main/java/eu/faircode/email/CloudSync.java:786–793  ·  view source on GitHub ↗
(String key, long revision)

Source from the content-addressed store, hash-verified

784 }
785
786 private static byte[] getAd(String key, long revision) throws NoSuchAlgorithmException {
787 byte[] k = MessageDigest.getInstance("SHA256").digest(key.getBytes());
788 byte[] ad = ByteBuffer.allocate(8 + 8)
789 .putLong(revision) // 8 bytes
790 .put(Arrays.copyOfRange(k, 0, 8))
791 .array();
792 return ad;
793 }
794
795 private static String transform(String value, byte[] key, byte[] iv, byte[] ad, boolean encrypt)
796 throws InvalidCipherTextException, IOException {

Callers 1

_callMethod · 0.95

Calls 5

allocateMethod · 0.80
digestMethod · 0.65
getInstanceMethod · 0.45
getBytesMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected