pull/38/head
kunfei 5 years ago
parent 8ae0ec73fa
commit a0fc5fe588
  1. 8
      app/src/main/java/io/legado/app/help/JsExtensions.kt
  2. 8
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt
  3. 4
      app/src/main/java/io/legado/app/utils/EncoderUtils.kt

@ -25,12 +25,12 @@ object JsExtensions {
/** /**
* js实现解码,不能删 * js实现解码,不能删
*/ */
fun base64Decoder(str: String): String { fun base64Decode(str: String): String {
return EncoderUtils.base64Decoder(str) return EncoderUtils.base64Decode(str)
} }
fun base64Encoder(str: String): String? { fun base64Encode(str: String): String? {
return EncoderUtils.base64Encoder(str) return EncoderUtils.base64Encode(str)
} }
fun strToMd5By32(str: String?): String? { fun strToMd5By32(str: String?): String? {

@ -572,12 +572,12 @@ class AnalyzeRule(private var book: BaseBook? = null) {
/** /**
* js实现解码,不能删 * js实现解码,不能删
*/ */
fun base64Decoder(str: String): String { fun base64Decode(str: String): String {
return EncoderUtils.base64Decoder(str) return EncoderUtils.base64Decode(str)
} }
fun base64Encoder(str: String): String? { fun base64Encode(str: String): String? {
return EncoderUtils.base64Encoder(str) return EncoderUtils.base64Encode(str)
} }
fun strToMd5By32(str: String?): String? { fun strToMd5By32(str: String?): String? {

@ -24,7 +24,7 @@ object EncoderUtils {
return tmp.toString() return tmp.toString()
} }
fun base64Decoder(str: String): String { fun base64Decode(str: String): String {
val bytes = Base64.decode(str, Base64.DEFAULT) val bytes = Base64.decode(str, Base64.DEFAULT)
return try { return try {
String(bytes, StandardCharsets.UTF_8) String(bytes, StandardCharsets.UTF_8)
@ -33,7 +33,7 @@ object EncoderUtils {
} }
} }
fun base64Encoder(str: String): String? { fun base64Encode(str: String): String? {
return Base64.encodeToString(str.toByteArray(), Base64.DEFAULT) return Base64.encodeToString(str.toByteArray(), Base64.DEFAULT)
} }
} }
Loading…
Cancel
Save