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

[Request]: Detect control files and automatically check for correspondence #177

Open
1 task done
Breizhux opened this issue Dec 20, 2023 · 1 comment
Open
1 task done
Labels
enhancement New feature or request

Comments

@Breizhux
Copy link

Describe the request

Hello,

Would it be possible to implement a function that automatically detects the checksum file associated with a given file, opens it, extracts the string corresponding to the checksum and automatically compares it to the checksum file?

Let me explain:

Suppose I open a "linux.iso" file to calculate its checksum.
Let's imagine that next to it is the file "linux.iso.sha256" or "linux.iso.sha256sum", which is not uncommon, since the two files are often downloaded from the same web page, with the two links next to each other.
It would be very useful to automatically detect whether such a file exists next to the open file. Open it, extract the result (often files contain [result sha256]\t[filename, here it would be "linux.iso"] or the reverse order [linux.iso]\t[result sha256].

In short, adding a condition of this style to the opening of a :

input_file = "linux.iso"
control_file = ""
if input_file+".sha256" exists :
    control_file = input_file+".sha256"
if input_file+".sha256sum" exists :
    control_file = input_file+".sha256sum"
if control_file != "" :
    content = read(control_file).split("\t")
    if content[0] == input_file :
        digest = content[1]
    else :
        digest = content[0]
    #when calcul input_file digest, verify if corresponding to readed digest, without others manipulations users.

Thank you for everything you can do!

Implementation Details

@Breizhux Breizhux added the enhancement New feature or request label Dec 20, 2023
@GeopJr
Copy link
Owner

GeopJr commented Dec 21, 2023

Thanks for the suggestion!

The main blocker for this is flatpak / portals. Collision can't access the whole folder but only the selected file.

I believe there was a work-in-progress portal to open neighboring files but it's not done yet.

In the meantime, if you select the text file with the hashes in the "Verify" tab, Collision will actually look inside of it and check if any hashes match:

image

(notice that the open file is a .iso while the one in the verify tab is a .sha256)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants