This commit is contained in:
Shikong 2023-07-24 10:46:23 +08:00
parent 9eb5d2bd96
commit 3bf4b7baa4
3 changed files with 14 additions and 2 deletions

View File

@ -4,3 +4,7 @@
export function CalcMD5(arg1:string,arg2:number):Promise<string>;
export function CalcSHA1(arg1:string,arg2:number):Promise<string>;
export function CalcSHA256(arg1:string,arg2:number):Promise<string>;
export function CalcSHA512(arg1:string,arg2:number):Promise<string>;

View File

@ -9,3 +9,11 @@ export function CalcMD5(arg1, arg2) {
export function CalcSHA1(arg1, arg2) {
return window['go']['hash']['Support']['CalcSHA1'](arg1, arg2);
}
export function CalcSHA256(arg1, arg2) {
return window['go']['hash']['Support']['CalcSHA256'](arg1, arg2);
}
export function CalcSHA512(arg1, arg2) {
return window['go']['hash']['Support']['CalcSHA512'](arg1, arg2);
}

View File

@ -17,7 +17,7 @@ func New(fileSupport *fileSdk.Support) *Support {
return &Support{fileSupport}
}
func (s *Support) CalcSha512(path string, readSize int64) (hash string, err error) {
func (s *Support) CalcSHA512(path string, readSize int64) (hash string, err error) {
h := sha512.New()
_, err = s.fileSupport.CopyN(h, path, readSize)
if err != nil {
@ -27,7 +27,7 @@ func (s *Support) CalcSha512(path string, readSize int64) (hash string, err erro
return hex.EncodeToString(h.Sum(nil)), nil
}
func (s *Support) CalcSha256(path string, readSize int64) (hash string, err error) {
func (s *Support) CalcSHA256(path string, readSize int64) (hash string, err error) {
h := sha256.New()
_, err = s.fileSupport.CopyN(h, path, readSize)
if err != nil {