-
Notifications
You must be signed in to change notification settings - Fork 479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
extractor: fix chillx #583
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙏 very nice, good to clean up the code
keyLength: Int = 32, | ||
ivLength: Int = 16, | ||
iterations: Int = 1 | ||
): List<ByteArray>? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pair<ByteArray,ByteArray>?
generatedLength += digestLength | ||
} | ||
return listOf( | ||
generatedData.copyOfRange(0, keyLength), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generatedData.copyOfRange(0, keyLength) to generatedData.copyOfRange(keyLength, targetKeySize)
fun generateKeyAndIv( | ||
password: ByteArray, | ||
salt: ByteArray, | ||
hashAlgorithm: String = "MD5", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would make the hashAlgorithm explicit, aka remove = "MD5"
data: String, | ||
pass: ByteArray, | ||
encrypt: Boolean = true, | ||
padding: String = "AES/CBC/PKCS5PADDING", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would make the padding explicit, aka remove = "AES/CBC/PKCS5PADDING"
padding: String = "AES/CBC/PKCS5PADDING", | ||
): String? { | ||
val parse = AppUtils.tryParseJson<AesData>(data) ?: return null | ||
val (key, iv) = generateKeyAndIv(pass, parse.s.hexToByteArray()) ?: throw ErrorLoadingException("failed to generate key") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
both throws and returns null 🤨
add @Throws
on the top of the function if that is intended
If you feel like that is good then react w 👍 and it will be merged |
No description provided.