本文整理匯總了TypeScript中@es-git/core.Sha1類的典型用法代碼示例。如果您正苦於以下問題:TypeScript Sha1類的具體用法?TypeScript Sha1怎麽用?TypeScript Sha1使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Sha1類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: next
async next(length? : number) {
if(length === undefined){
const result = await super.next();
this.temp[0] = result;
this.sha.update(this.temp);
return result;
}else{
const result = await super.next(length);
return this.sha.update(result);
}
}
示例2:
async nextInt32() : Promise<number> {
const buffer = await super.next(4);
this.sha.update(buffer);
let result = 0;
for(let i=0; i<4; i++){
result = (result << 8) | buffer[i];
}
return result;
}
示例3: digest
digest(){
const result = this.sha.digest();
this.sha = sha1();
return result;
}
示例4: rewind
rewind(length : number){
if(this.tempChunk) this.sha.update(this.tempChunk.subarray(0, this.tempChunk.length - length));
this.tempChunk = undefined;
super.rewind(length);
}
示例5: chunk
async chunk() {
if(this.tempChunk) this.sha.update(this.tempChunk);
this.tempChunk = await super.chunk();
return this.tempChunk;
}