博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
git sha计算
阅读量:4634 次
发布时间:2019-06-09

本文共 841 字,大约阅读时间需要 2 分钟。

import Hashes from "jshashes";const sha1 = new Hashes.SHA1().setUTF8(true);const getStringByteLength = function(str) {    var totalLength = 0;         var charCode;      for (var i = 0; i < str.length; i++) {          charCode = str.charCodeAt(i);          if (charCode < 0x007f)  {                 totalLength++;             } else if ((0x0080 <= charCode) && (charCode <= 0x07ff))  {                 totalLength += 2;             } else if ((0x0800 <= charCode) && (charCode <= 0xffff))  {                 totalLength += 3;           } else{              totalLength += 4;           }              }      return totalLength;   }const gitsha = function(content) {    var header = "blob " + getStringByteLength(content) + "\0";    var text = header + content;    return sha1.hex(text);}

转载于:https://www.cnblogs.com/--xiaoyao--/p/9000962.html

你可能感兴趣的文章
ddr3调试经验分享(一)——modelsim实现对vivado中的MIG ddr3的仿真
查看>>
Scrum开发模式
查看>>
MappedByteBuffer
查看>>
搭建邮件服务器 Postfix + Dovecot (CentOS)
查看>>
DBConvert Studio 数据迁移转换
查看>>
CSS3-Canvas画布(线条)
查看>>
反射类
查看>>
leetcode 64. Minimum Path Sum
查看>>
解决NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config
查看>>
百度云分享下载链接
查看>>
AttributeError: module 'matplotlib' has no attribute 'verbose'
查看>>
模块module
查看>>
php运算符容易入坑的题目
查看>>
02-css的选择器
查看>>
欧拉计划007
查看>>
spring controller方法和jstl
查看>>
精品电子书分享 – 《JavaScript Enlightenment.PDF》
查看>>
16个时髦的扁平化设计的 HTML5 & CSS3 网站模板
查看>>
could not instantiate class [com.jinqing.cashier.entity.abstractVO.TradeItemVO] from tuple
查看>>
Java_JVM参数-XX:MaxDirectMemorySize 与 两种 ByteBuffer: heap,direct ByteBuffer
查看>>