Sha256sum gets calculated as well now (closes #44)
ci/woodpecker/push/lint unknown status
Details
ci/woodpecker/push/release unknown status
Details
ci/woodpecker/push/builder Pipeline was successful
Details
ci/woodpecker/push/build Pipeline was successful
Details
ci/woodpecker/push/image Pipeline was successful
Details
ci/woodpecker/push/publish Pipeline was successful
Details
ci/woodpecker/push/lint unknown status
Details
ci/woodpecker/push/release unknown status
Details
ci/woodpecker/push/builder Pipeline was successful
Details
ci/woodpecker/push/build Pipeline was successful
Details
ci/woodpecker/push/image Pipeline was successful
Details
ci/woodpecker/push/publish Pipeline was successful
Details
parent
cb492cadc6
commit
3c0b7156c1
|
@ -201,12 +201,10 @@ pub fn (pkg &Pkg) to_desc() string {
|
||||||
desc += format_entry('CSIZE', p.csize.str())
|
desc += format_entry('CSIZE', p.csize.str())
|
||||||
desc += format_entry('ISIZE', p.size.str())
|
desc += format_entry('ISIZE', p.size.str())
|
||||||
|
|
||||||
md5sum, _ := pkg.checksum() or { '', '' }
|
md5sum, sha256sum := pkg.checksum() or { '', '' }
|
||||||
|
|
||||||
desc += format_entry('MD5SUM', md5sum)
|
desc += format_entry('MD5SUM', md5sum)
|
||||||
|
desc += format_entry('SHA256SUM', sha256sum)
|
||||||
// TODO add this
|
|
||||||
// desc += format_entry('SHA256SUM', sha256sum)
|
|
||||||
|
|
||||||
// TODO add pgpsig stuff
|
// TODO add pgpsig stuff
|
||||||
|
|
||||||
|
|
13
src/util.v
13
src/util.v
|
@ -2,7 +2,7 @@ module util
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import crypto.md5
|
import crypto.md5
|
||||||
// import crypto.sha256
|
import crypto.sha256
|
||||||
|
|
||||||
// hash_file returns the md5 & sha256 hash of a given file
|
// hash_file returns the md5 & sha256 hash of a given file
|
||||||
// TODO actually implement sha256
|
// TODO actually implement sha256
|
||||||
|
@ -10,7 +10,7 @@ pub fn hash_file(path &string) ?(string, string) {
|
||||||
file := os.open(path) or { return error('Failed to open file.') }
|
file := os.open(path) or { return error('Failed to open file.') }
|
||||||
|
|
||||||
mut md5sum := md5.new()
|
mut md5sum := md5.new()
|
||||||
// mut sha256sum := sha256.new()
|
mut sha256sum := sha256.new()
|
||||||
|
|
||||||
buf_size := int(1_000_000)
|
buf_size := int(1_000_000)
|
||||||
mut buf := []byte{len: buf_size}
|
mut buf := []byte{len: buf_size}
|
||||||
|
@ -23,11 +23,12 @@ pub fn hash_file(path &string) ?(string, string) {
|
||||||
|
|
||||||
// For now we'll assume that this always works
|
// For now we'll assume that this always works
|
||||||
md5sum.write(buf[..bytes_read]) or {
|
md5sum.write(buf[..bytes_read]) or {
|
||||||
return error('Failed to update checksum. This should never happen.')
|
return error('Failed to update md5 checksum. This should never happen.')
|
||||||
|
}
|
||||||
|
sha256sum.write(buf[..bytes_read]) or {
|
||||||
|
return error('Failed to update sha256 checksum. This should never happen.')
|
||||||
}
|
}
|
||||||
// sha256sum.write(buf) or {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// return md5sum.sum(buf).hex(), sha256sum.sum(buf).hex()
|
return md5sum.checksum().hex(), sha256sum.checksum().hex()
|
||||||
return md5sum.checksum().hex(), ''
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue