security: SHA256校验通过Android Bridge(Java侧计算)
- Bridge.sha256() 用 MessageDigest 计算 - JS下载后 Android.sha256(t) 比对 version.txt 哈希 - version.txt 恢复三列: ver|url|sha256 - 避免 Web Crypto API 在 file:// 域不可用问题
This commit is contained in:
@@ -1 +1 @@
|
|||||||
0.1.0-dav-android-6|https://git.childish-ghost.com/LukeMackin/Yuzu-GCA/raw/branch/main/ota/h5/index-v6.html
|
0.1.0-dav-android-6|https://git.childish-ghost.com/LukeMackin/Yuzu-GCA/raw/branch/main/ota/h5/index-v6.html|a53319e28c5b9ce5da6799d9b2fe547f4391386f23b68ac10814567edd445188
|
||||||
Binary file not shown.
Binary file not shown.
@@ -48,6 +48,12 @@ class MainActivity : AppCompatActivity() {
|
|||||||
ctx.cacheFile.delete()
|
ctx.cacheFile.delete()
|
||||||
Log.i(TAG, "Cache cleared")
|
Log.i(TAG, "Cache cleared")
|
||||||
}
|
}
|
||||||
|
@android.webkit.JavascriptInterface
|
||||||
|
fun sha256(input: String): String {
|
||||||
|
val md = java.security.MessageDigest.getInstance("SHA-256")
|
||||||
|
val digest = md.digest(input.toByteArray(Charsets.UTF_8))
|
||||||
|
return digest.joinToString("") { "%02x".format(it) }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object { private const val TAG = "GCA-H5" }
|
companion object { private const val TAG = "GCA-H5" }
|
||||||
|
|||||||
Reference in New Issue
Block a user