!152 delete hash-sun md5 add jssha

Merge pull request !152 from Bo Jiang/replaceVERSION
This commit is contained in:
openharmony_ci 2023-05-25 12:37:46 +00:00 committed by Gitee
commit 5c3f5ff925
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 8 additions and 4 deletions

View File

@ -1,6 +1,6 @@
var path = require('path')
var fs = require('fs')
var md5 = require('md5')
const crypto = require("crypto")
var existsSync = fs.existsSync || path.existsSync
var nodePaths = process.env.NODE_PATH ? process.env.NODE_PATH.split(':') : []
@ -83,7 +83,9 @@ function parseAndReplaceRequire(code, curPath) {
return $0
}
else {
var md5Path = md5(subModulePath)
const hash = crypto.createHash('sha256')
hash.update(subModulePath.toString())
var md5Path = hash.digest('hex')
requires[md5Path] = subModulePath
return 'browserifyRequire("' + md5Path + '")'
}

View File

@ -20,7 +20,7 @@
import path from 'path'
import fs from 'fs'
import loaderUtils from 'loader-utils'
import hash from 'hash-sum'
const crypto = require("crypto")
import {
SourceMapGenerator,
SourceMapConsumer
@ -37,7 +37,9 @@ export function getNameByPath (resourcePath) {
export function getFileNameWithHash (resourcePath, content) {
const filename = path.relative('.', resourcePath)
const cacheKey = hash(filename + content)
const hash = crypto.createHash('sha256')
hash.update((filename + content).toString())
const cacheKey = hash.digest('hex')
return `./${filename}?${cacheKey}`
}