mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-08-04 03:46:57 -04:00
Use more hash algorithms to generate checksum files
This commit is contained in:
parent
6da38e537b
commit
345598016a
@ -55,9 +55,16 @@ def digest(String algorithm, byte[] bytes) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def createChecksum(File file) {
|
def createChecksum(File file) {
|
||||||
def algorithm = "SHA-1"
|
def algorithms = [
|
||||||
def suffix = "sha1"
|
["MD5", "md5"],
|
||||||
new File(file.parentFile, file.name + "." + suffix).text = digest(algorithm, file.bytes).encodeHex().toString() + "\n"
|
["SHA-1", "sha1"],
|
||||||
|
["SHA-256", "sha256"],
|
||||||
|
["SHA-512", "sha512"]
|
||||||
|
]
|
||||||
|
|
||||||
|
for (algorithm in algorithms) {
|
||||||
|
new File(file.parentFile, file.name + "." + algorithm[1]).text = digest(algorithm[0], file.bytes).encodeHex().toString() + "\n"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def attachSignature(File jar) {
|
def attachSignature(File jar) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user