Bash Script to find/sort/move images/duplicate images from USB drive

Ultimately, I'm looking to create a script that allows me to plug in a usb drive with lots of jpegs on it & copy them over to a folder on my hard drive. So in the process of copying I am looking to hash check them, record dupes to a file, copy only 1 of the identical files (if it doesn't exsist in the hard drive folder already) while renaming any files of the same name that are NOT identical (ie same hash) but copying them over too.
Thanks for any help

I use SHA to identify dups, too. I'd collect all existing files with their hashes by doing something along these lines:

 (
 for f1 in $( find $PHOTOS -type f -name "*.jpeg" ); do
        shasum $f1;
done
 ) > EXISTING;
  
 

then I would get new SHA and grep against existing to discard incoming dups.