mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
normalize line endings
This commit is contained in:
@@ -1,29 +1,29 @@
|
||||
package com.commafeed.backend;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import com.google.common.hash.HashFunction;
|
||||
import com.google.common.hash.Hashing;
|
||||
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
@UtilityClass
|
||||
@SuppressWarnings("deprecation")
|
||||
public class Digests {
|
||||
|
||||
public static String sha1Hex(byte[] input) {
|
||||
return hashBytesToHex(Hashing.sha1(), input);
|
||||
}
|
||||
|
||||
public static String sha1Hex(String input) {
|
||||
return hashBytesToHex(Hashing.sha1(), input.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
public static String md5Hex(String input) {
|
||||
return hashBytesToHex(Hashing.md5(), input.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
private static String hashBytesToHex(HashFunction function, byte[] input) {
|
||||
return function.hashBytes(input).toString();
|
||||
}
|
||||
}
|
||||
package com.commafeed.backend;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import com.google.common.hash.HashFunction;
|
||||
import com.google.common.hash.Hashing;
|
||||
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
@UtilityClass
|
||||
@SuppressWarnings("deprecation")
|
||||
public class Digests {
|
||||
|
||||
public static String sha1Hex(byte[] input) {
|
||||
return hashBytesToHex(Hashing.sha1(), input);
|
||||
}
|
||||
|
||||
public static String sha1Hex(String input) {
|
||||
return hashBytesToHex(Hashing.sha1(), input.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
public static String md5Hex(String input) {
|
||||
return hashBytesToHex(Hashing.md5(), input.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
private static String hashBytesToHex(HashFunction function, byte[] input) {
|
||||
return function.hashBytes(input).toString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user