reset password
Author Message
Miro138
Posts: 22
Posted 18:32 Mar 06, 2017 |

I still need a bit of clarification regarding the crypto module usage. During the Lab, crypto was emphasized to get a hash of the file contents. On slide 23/25 of the pdf it doesn't really mention what to do with it. Is it supposed to output the directories as a hash or is it just to be used to allow for comparison and duplicate detection with other files by and modules? 

Last edited by Miro138 at 18:41 Mar 06, 2017.
hieuphan005
Posts: 5
Posted 22:15 Mar 06, 2017 |

If you used what was in the hash example, it console.log the hash value in hex. What I did instead of console.log the value, I saved it into a variable and used that as a signature to tell whether 2 files are the same or not.

acervantes
Posts: 28
Posted 07:30 Mar 07, 2017 |

HieuPhan005 is correct. Since files can have different file names, it is not okay to merely hash the file name. We are interested in the contents of a file. If the contents of a file yields the same hash as the contents of another file, it is reasonable to assume that the contents of both files are identical. This is the goal of the lab. We want to allow our user to submit a path, traverse it and all subdirectories, and report any duplicates we find. 

 

You can can refer to the screenshots in the PDF For an example of what the output can be. 

Miro138
Posts: 22
Posted 11:44 Mar 07, 2017 |

Alright, its making a bit more sense. Thank you.