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

Replace SHA3-224 algorithm in text-buffer by SHA1 #8662

Open
Akirathan opened this issue Jan 3, 2024 · 8 comments
Open

Replace SHA3-224 algorithm in text-buffer by SHA1 #8662

Akirathan opened this issue Jan 3, 2024 · 8 comments
Assignees

Comments

@Akirathan
Copy link
Member

Akirathan commented Jan 3, 2024

In text-buffer, SHA3-224 is used for calculating the checksum of a text content -

override def evalVersion(content: CharSequence): ContentVersion = {

According to the original author, @4e6, there is no reason to use specifically SHA3-224, so we can just use the simpler SHA-1.

Note that this change also requires modifications to some gui parts.

Related to:

@hubertp
Copy link
Contributor

hubertp commented Jan 3, 2024

A duplicate of #6691 I think.

@hubertp hubertp unassigned 4e6 Jan 3, 2024
@hubertp hubertp added the triage label Jan 3, 2024
@4e6
Copy link
Contributor

4e6 commented Jan 3, 2024

I think the scope is different. This one only implies the change of hashing algorithm in the text/applyEdit request.

@4e6
Copy link
Contributor

4e6 commented Jan 3, 2024

Also @Akirathan, if the goal is just to remove the bouncycastle dependency, can the version calclulator use the same logic with the MessageDigest from the standard library as FileSystem does? Without changing the algo

override def digest(path: File): BlockingIO[FileSystemFailure, SHA3_224] = {
if (path.isFile) {
attemptBlocking {
val messageDigest = MessageDigest.getInstance("SHA3-224")
Using.resource(
Files.newInputStream(path.toPath, StandardOpenOption.READ)
) { stream =>
var currentBytes = stream.readNBytes(fileChunkSize)
while (currentBytes.nonEmpty) {
messageDigest.update(currentBytes)
currentBytes = stream.readNBytes(fileChunkSize)
}
SHA3_224(messageDigest.digest())

@4e6
Copy link
Contributor

4e6 commented Jan 3, 2024

Ok, I see, you already did it in #8664

@Akirathan
Copy link
Member Author

Ok, I see, you already did it in #8664

Yes. Removing the org.bouncycastle dependency is a related, but different task. And it is done in #8664.

@hubertp
Copy link
Contributor

hubertp commented Jan 3, 2024

I think the scope is different. This one only implies the change of hashing algorithm in the text/applyEdit request.

Fine, but there is a problem (at least currently) when we have to support both, old and new, GUI. They can't use different algorithms. I would say this would have to wait until old GUI is completely dropped and still will be an incompatible change.

@JaroslavTulach
Copy link
Member

this would have to wait until old GUI is completely dropped

Or we can fix the old GUI to use SHA-1. I assume downgrading the algorithm is going to be easy.

@jdunkerley
Copy link
Member

On hold until GUI1 is retired then we will switch to SHA1 in GUI2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 📤 Backlog
Development

No branches or pull requests

5 participants