Code Monkey home page Code Monkey logo

Comments (7)

samuel-lucas6 avatar samuel-lucas6 commented on September 25, 2024 1

it won't make the UX for hashing files/folders more complex than it was before (because the UX won't change).

That's true; what I meant was that it would add another option.

Sorry I was not clear. Obviously, we will need a --text flag, what I desired to say was that with the approach that I have in mind we won't need to add new else if statements to the OnExecute method to handle text. Maybe it is easier to understand when you look at the code I made a simple commit that implements the hash text feature with the approach that I have in mind. I didn't rename any variables/methods names so it should be easier to see the important changes.

Yes, I see what you mean. The Stream idea is definitely nice, and thank you for the demo; I like your terminal. It's tempting. I think I'd implement it slightly differently, and I have a lot of things on my plate at the moment, but I suppose this wouldn't take long.

from milva.

BluePositive avatar BluePositive commented on September 25, 2024 1

@samuel-lucas6 wow I didn't expect it to be done so quickly. I like to way you implement it nice job!
Thanks a lot!

(Btw my terminal is tabby using PowerShell with posh-git)

from milva.

samuel-lucas6 avatar samuel-lucas6 commented on September 25, 2024

I suppose the question is what's the use case for this? As far as I know, the hashing functionality on Windows only supports files, and it's possible to create a text file to hash text that way. There would need to be a separate option for text.

from milva.

BluePositive avatar BluePositive commented on September 25, 2024

The use case for me is when I want to show someone how hashing works I usually find an online text to sha256 converter and show them that when typing "Hello" the hash is... and when I change the text to "hello" it changes the hash completely, it will help if I can just do it locally. That is just my (stupid) use case, but I think it could also be useful when you have a list of words and you want to see if 1 of these words matches some hash.

I didn't understand what you mean by

Windows only supports files,

all the hashing algorithms that you are using (in the GetHash method) are accepting a Stream and a string can easily be converted to a Stream. I actually played around with it a little and it was working for me on Windows.

About a separate option for text I think we don't need to add only 1 IsText flag and if we came up with a good name for the FilePaths property (better than FilePathsOrText 😏) we don't need to add more else if statements to the OnExecute method we just need to pass in the IsText flag to the HashEachFile method and have an if(isText) statement inside the HashEachFile method to convert the text to a Stream.

The most challenging part of this feature looks like changing the variables/methods names.

from milva.

samuel-lucas6 avatar samuel-lucas6 commented on September 25, 2024

The use case for me is when I want to show someone how hashing works I usually find an online text to sha256 converter and show them that when typing "Hello" the hash is... and when I change the text to "hello" it changes the hash completely, it will help if I can just do it locally. That is just my (stupid) use case, but I think it could also be useful when you have a list of words and you want to see if 1 of these words matches some hash.

I know what you mean, but that could be done using a text file; it would just be more inconvenient. That second use case would probably require a custom program/script that reads each line in a text file.

I didn't understand what you mean by Windows only supports files

Sorry, that wasn't very clear. I'm referring to certutil and PowerShell. I made this tool to simplify such usage and to support newer algorithms. Ideally, the UX should be as simple as possible.

About a separate option for text I think we don't need to add only 1 IsText flag and if we came up with a good name for the FilePaths property (better than FilePathsOrText 😏) we don't need to add more else if statements to the OnExecute method we just need to pass in the IsText flag to the HashEachFile method and have an if(isText) statement inside the HashEachFile method to convert the text to a Stream.

But how will a file/directory name be distinguished from regular text? Or do you mean an option like --text?

from milva.

BluePositive avatar BluePositive commented on September 25, 2024

About the benefit of this feature, I still think that it is a useful feature, and it won't make the UX for hashing files/folders more complex than it was before (because the UX won't change).

But how will a file/directory name be distinguished from regular text? Or do you mean an option like --text?

Sorry I was not clear. Obviously, we will need a --text flag, what I desired to say was that with the approach that I have in mind we won't need to add new else if statements to the OnExecute method to handle text. Maybe it is easier to understand when you look at the code I made a simple commit that implements the hash text feature with the approach that I have in mind. I didn't rename any variables/methods names so it should be easier to see the important changes.

Here is how it looks in action.

image

from milva.

samuel-lucas6 avatar samuel-lucas6 commented on September 25, 2024

Thank you and for the donation! I'll try and do a release soon. I'll look into that.

from milva.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.