Skip to content

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

@Breizhux

Description

@Breizhux

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions