Skip to content
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

Merged
merged 4 commits into from
Sep 1, 2023
Merged

extractor: fix chillx #583

merged 4 commits into from
Sep 1, 2023

Conversation

Sofie99
Copy link
Contributor

@Sofie99 Sofie99 commented Aug 29, 2023

No description provided.

Copy link
Contributor

@LagradOst LagradOst left a 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>? {
Copy link
Contributor

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),
Copy link
Contributor

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",
Copy link
Contributor

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",
Copy link
Contributor

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")
Copy link
Contributor

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

@LagradOst
Copy link
Contributor

If you feel like that is good then react w 👍 and it will be merged

@LagradOst LagradOst merged commit 9c991f2 into recloudstream:master Sep 1, 2023
2 checks passed
@Sofie99 Sofie99 deleted the Chillx branch September 7, 2023 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants