View Single Post
  #53  
Old 2020-02-18, 07:10 PM
Five's Avatar
Five Five is offline
 
Join Date: Oct 2004
Location: Canada
Re: The Validity of MD5 Checksums

Peter King's SHN 2k Batch Files ... The functionality of this software is most impressive and useful yet never carried forward into the flac era. it was linked for many years from etree.org top software links.

Peter King's SHN 2k Batch Files v0.9 beta7 · 7/16/02 is the final known revision. if anybody has a copy of this, please pm me, I was unfortunately only able to find Peter King's SHN 2k Batch Files v0.80 · 12/14/01 (shown below in full)

from the SHN2K homepage, only online from 2002-2003
Quote:
Originally Posted by Peter King
SHN2k -- the shorten compression assistant for Windows


Introduction

Today's tools for creating .shn files leave a lot to be desired the way content is organized -- noname.md5, anyone? -- and it occurred to me that a Better Way was within our grasp. Enter SHN2k, a batch file for Windows that creates a burn-ready folder of .shn files from your .wav source files. -- a .shn folder in complete compliance with the etree standard, available at your fingertips any time via the Start>Run panel.

SHN2k was born when I noticed there was no existing command-line tool for Windows 2000 in the etree archive. I began by duplicating the functionality of the existing 'compress.bat' code for Win98, but that only got my mind wandering about further things that could be done with the script! Around the same time, I had some sketchy content come my way in a few e-trades: files with inconsistent names, folders mixed with .shn and .mkw files (none of which matched the included 'noname.md5'), and the like. Why not create a tool that makes this sort of thing impossible?

Why not create a tool that does it all -- the right way?


What It Does

Best, I think, to say it with pictures!
These are your .wav files, ready for encoding... Start > Run > SHN2k project_name -- it's that easy! SHN2k creates .shn files, an .md5 file, encode notes, wrapped up in a .shnf (shorten folder) -- all named consistently.

[image missing] [image missing] [image missing]

SHN2k creates a folder completely ready to burn or to send to the FTP server of your choice. it also automatically creates a 'VERIFY' script for anyone who might be receiving these .shn files from you. Just double click on the included VERIFY script and it checks the validity of the .shn files and, if they pass the inspection, expands them.

If you'd like to see the encode_notes file or VERIFY_ script from the above example, click on their names. [these two links reproduced in full below]


How Do I Use It?

Before using SHN2k the first time, you've got to edit the script to reflect your specific PC system, namely where your .wav files are stored and where you'd like to resulting .shn content to go. To do this, simply open the script in Notepad and follow along -- the few lines that require your intervention are very clearly marked. You'll also see fields for your name and the equipment you regularly use to create your .shn files, which is used to create the 'encode_nodes' file. You only need to do this once -- and once you're ready, save the SHN2k script in your windows system directory:

windows 95/98/ME users save it to c:\windows\command
windows 2000/XP users save it to c:\winnt\system32
(In the SHN2k.zip file there are also handy shortcuts to these paths to make installation very simple.)

You also *must* have shortn32.exe and md5sum.exe installed in the same location. Please download them here. if you don't have them already. (mkwACT users *will* need to install these two additional files.)

Now that you've done that, the fun can begin!

To use SHN2k, all you need is a folder of .wav files that you'd like to convert to .shn. It is probably the best idea to name your source files as in the example above, namely

t01.wav
t02.wav
etc.

( I've configured EAC on my system to output tracks named in this fashion when I extract, or when I'm mastering a new source, I use 'Extract Regions' in SoundForge 4.5. If you'd like more info on how I get my source .wav files named this way, email me.)

Once you've got files ready to encode, it really is as easy as calling 'Start > Run > SHN2k' and providing it with the name of your .wav project, date and name of band, what have you.

At the end of the process, it will automatically open the resulting .shnf folder so you can further edit the 'encode notes' file -- add a setlist, venue details, etc., run the VERIFY script if you'd like to check the validity of the files you've just created, etc.


Downloads

SHN2k is completely free for non-commercial use. I cannot be held responsible for any damage or unpredictable results that befall your system as a result of using this script. But, having said that, it's just a formality. I've been using SHN2k exclusively to create my .shn material for the last three months. It works. :-)

SHN2k.zip download


Support Notes

As the name somewhat implies, SHN2k was developed originally and optimized for Windows 2000 since there was no existing command-line solution. Windows 9x functionality was an afterthought, and, while it works, certainly things aren't as silky as in Win2k.

Windows 98 users will have better results if, instead of calling SHN2k from Start > Run, they open a DOS session first. (Start > Run > command) Then, once the DOS box is open, run SHN2k.

If you've installed Windows in a non-standard location -- anything other than c:\windows or c:\winnt -- you're going to have to manually modify the code of SHN2k. If you need to do this, email me and I'll give you some pointers.

:: TODO for v1.00 --
:: chomp on one file at a time
:: resolve wav_md5 naming problem
:: menu driven
:: turbo mode !!!
:: investigate 'out of environment space' error in win98 w / start-run method LEADS TO VERSION # not working
:: works when memory is allocated to it explicitly, but not by default. wtf?!!?
:: accept argument after project_name to replace local .wav location (maybe)
:: if temp_dir already exists, make new path (in the event of multiple encode sessions)

:: *** if you direct output to a subfolder, at md5 creation there's a 'cannot find path specified'
:: 'starting compression' just as the thing is finishing???
:: *** if a file is in use -- output an error message when trying to move to temp directory
:: *** make everything read-write before processing
:: rename folder with .shnf extension depending on name???
:: PREP mode -- chops name of files in current folder up to t0x.wav (DARING!!!!!)
:: VERIFY script -- instead of 'confirming shn.md5' why not give specific name to the md5 being verified
:: VERIFY script doesn't work when content has lived on a CD-rom (read/write issues i suspect)

:: RECENTLY FINISHED:
:: VERIFY_.bat for win9x
:: remove .shn extension before extracting
:: extract mode
:: VERIFY script needs version number
:: 'processing PROJECT_NAME...'
:: VERIFY only extracts files starting with name same as its own - line 343
:: add only relevant files to the .md5 file
:: VERIFY pop open relevant window
:: win98 time/date stamping -- done, but why phantom character??
:: BLANK VARIABLE = usage notes
:: -edit mode brings up script into notepad??
:: create warning file in temp folder about premature ejections

encode_notes.txt
Code:
dbyrne_05-24-01_fm 
 
encoded by pwking	 (sleepypedro_at_yahoo.com) 
Wed 01/23/2002 @ 6:02pm 
 
audio extraction:  Plextor PX-W1610A ~ EAC (secure mode) ~ shn2k 
 
i rip, therefore i am! 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
created by shn2k (v.0.9 beta5) 
the shorten compression assistant for windows 2000 + beyond 
written by peter w. king (sleepypedro_at_yahoo.com) 
(c)2002 crabcollective productions
VERIFY_ script
Code:
@echo off 
cls 
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
echo VERIFY_dbyrne_05-24-01_fm.bat 
echo created by shn2k (v.0.9 beta5) 
echo the shorten compression assistant for windows 2000 + beyond 
echo written by peter w. king (sleepypedro_at_yahoo.com) 
echo (c)2002 crabcollective productions 
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
echo verifying shn.md5 checksum 
echo. 
md5sum -c dbyrne_05-24-01_fm_shn.md5 
echo. 
if errorlevel=1 goto NOT_ROCKING 
if errorlevel=0 goto FULLY_ROCKING 
 
:NOT_ROCKING 
echo Please try re-downloading the track(s) in question.  Your copy doesn't match.  
goto end 
 
:FULLY_ROCKING 
if "C:\WINNT"=="C:\WINNT" goto NEXT_SECTION 
echo. 
lfnfor on 
:NEXT_SECTION 
echo shorten files validated -- 
echo i'll extract them for you now! 
echo. 
:FILE_RENAMER 
mkdir temp_dir 
FOR %%f in (dbyrne_05-24-01_fm*.shn) DO move "%%f" "temp_dir\%%f" 
cd temp_dir 
FOR %%f in (*.shn) DO rename *.* *. 
FOR %%f in (*) DO shortn32 -x %%f ..\%%f.wav 
FOR %%f in (*) DO rename * *.shn 
FOR %%f in (*.shn) DO move "%%f" "..\%%f" 
cd ..  
if "C:\WINNT"=="C:\WINNT" rmdir /Q temp_dir 
if "C:\WINNT"=="C:\WINDOWS" rmdir temp_dir 
explorer . 
:end
readme.txt
Code:
::**************************************************************
::*  SHN2K v0.80
::*  the shorten compression assistant for Windows 2000 & beyond
::*  written by peter w. king ([email protected])
::*  12-14-2001
::**************************************************************

Hi there!  Welcome to shn2k!  This script was written to facilitate the creation
of shorten files and their corresponding .md5 checksums that automagically conform
to the naming convention of your choice -- no more files named Track01.shn, Track02.shn
and the god-awful 'noname.md5'!  Try it, I think you'll like it!

Please edit the variables in the shn2k.bat file so that they match your exact setup, then save the file.

for win2000 / nt4 / XP(?) :  save it in the \system32 folder of your \winnt directory (probably c:\winnt\system32)
for win98:  save it in the \command folder of your \windows directory (probably c:\windows\command)

after that, using the script is as easy as

Start >
Run >
shn2k disk_name

it is assumed you've already got shortn32.exe and md5sum.exe installed correctly.  if not, download these small programs from www.etree.org and install them in the same folder where you've installed this script.

please email me with comments/questions/suggestions/etc.

::  TODO for v1.00
::  windows9x date/time stamping
::  return to original DOS directory?
::  menu driven
::  turbo mode !!!
::  extract mode
::  autogenerate confirmation.bat script that both confirms and extracts for recipients
Code:
::**************************************************************
::*  SHN2K v0.80
::*  the shorten compression assistant for Windows 2000 & beyond
::*  written by peter w. king ([email protected])
::*  12-14-2001
::**************************************************************
@echo off
goto variable_declaration

Hi there!  Welcome to shn2k!  This script was written to facilitate the creation
of shorten files and their corresponding .md5 checksums that automagically conform
to the naming convention of your choice -- no more files named Track01.shn, Track02.shn
and the god-awful 'noname.md5'!  Try it, I think you'll like it!

Please edit the variables in the section below these notes
so that they match your exact setup, then save the file.

for win2000 / nt4 / XP(?) :  save it in the \system32 folder of your \winnt directory (probably c:\winnt\system32)
for win98:  save it in the \command folder of your \windows directory (probably c:\windows\command)

after that, using the script is as easy as

Start >
Run >
shn2k disk_name

it is assumed you've already got shortn32.exe and md5sum.exe installed correctly.  if not, download these small programs from www.etree.org and install them in the same folder where you've installed this script.

see KNOWN ISSUES at the end for further notes
please email me with comments/questions/suggestions/etc.

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:variable_declaration
:: WHERE ARE YOUR WAV FILES STORED, d00d?
REM for example, if c:\wavs, set the variables as follows:
set wav_drive=c
set wav_path=wavs

REM the wav_path can also be a full pathname, e.g. 'data\wavs\doo-wop\60s'

:: WHERE SHALL I STORE YOUR SHN FILES, d00d?
set shn_drive=c
set shn_path=shn

:: USER SPECIFIC INFO
set your_name=dirk diggler
set your_email=dirk@feel_my_heat.org
set your_gear=some cd-rom ~ EAC ~ shn2k
REM you can't use the > mark, which is why i'm using the ~ above
set adjustable_slogan=i rip, therefore i am!

set temp_dir=shn2k
REM this folder will be deleted as soon as work is done.

REM ok, that's it!  now save the file and you're ready to go.
goto greenlight

:opening_credits
*  PREREQUISITES:
*  shortn32 & md5sum installed somewhere in your %PATH (eg. c:\winnt\system32 or c:\windows\command)
*
*  usage:
*  modify operating variables
*  open DOS shell (start > run > 'shn2k cd_name'  (without ' marks, and no spaces in 'cd_name')
*
**********************************************************

:highly_anomalous
REM echo %WINDIR%
if "%WINDIR%"=="C:\WINNT" echo you are using windows NT or 2000
if NOT "%WINDIR%"=="C:\WINDOWS" echo you are using windows 9x
goto end

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:  EVERYTHING BELOW IS PRODUCTION CODE.  DO NOT MODIFY.  THANKS.
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:wav_directory_is_bad
echo.
echo TROUBLE WITH YOUR CHOSEN WAV_DIRECTORY --
echo %wav_drive%:\%wav_path% doesn't exist; the program will end.
echo.
echo please edit the shn2k.bat file and modify the 'wav_path' variable
goto end

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:shn_directory_is_bad
if NOT exist %shn_path% mkdir %shn_drive%:\%shn_path%
echo.
echo your chosen shn_path, %shn_drive%:\%shn_path%,
echo did not exist so I created it for you.
echo.
goto checkup_pt2

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:shn32_no_esta_aqui
echo.
echo SHORTN32.EXE DOESN'T SEEM TO EXIST --
echo please install it correctly and try shn2k again; the program will now end.
echo.
goto end

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:greenlight
cls
echo **********************************************************************
echo *                                                                    *
echo *  SHN2K -- the shn compression assistant for Windows 2000 + beyond  *
echo *                                                                    *
echo *          written by peter w king ([email protected])           * 
echo *                                                                    *
echo **********************************************************************
echo.

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:checkup
REM if "%WINDIR%"=="C:\WINDOWS" if NOT exist %wav_drive%:\%wav_path% goto wav_directory_is_bad
REM if "%WINDIR%"=="C:\WINDOWS" if NOT exist %shn_drive%:\%shn_path% goto shn_directory_is_bad

REM why do these win9x lines work as you'd expect?

if "%WINDIR%"=="C:\WINNT" if NOT exist %wav_drive%:\%wav_path% goto wav_directory_is_bad
if "%WINDIR%"=="C:\WINNT" if NOT exist %shn_drive%:\%shn_path% goto shn_directory_is_bad

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:checkup_pt2
shortn32 -h > nul
if errorlevel=1 goto shn32_no_esta_aqui
if "%WINDIR%"=="C:\WINNT" goto opening_statement

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:special_for_w9x_users
lfnfor on

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:opening_statement

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:setup

%wav_drive%:
cd \
cd %wav_path%

mkdir %temp_dir%
FOR %%f in (*.wav) DO move "%%f" "%wav_drive%:\%wav_path%\%temp_dir%\%%f" > nul
REM echo just moved files to temp_dir
cd %temp_dir%
mkdir %shn_drive%:\%shn_path%\%1.shnf

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:wav_md5_&_shn_prep
echo preparing wav_md5 checksum
FOR %%f in (*.wav) DO md5sum "%%f" >> "%shn_drive%:\%shn_path%\%1.shnf\%1_wav.md5"
FOR %%f in (*.wav) DO rename *.* *.

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:shn_conversion
if "%WINDIR%"=="C:\WINNT" FOR %%f in (*) DO echo encoding track %%f.wav & shortn32 "%%f" "%shn_drive%:\%shn_path%\%1.shnf\%1_%%f.shn" > nul
if "%WINDIR%"=="C:\WINNT" goto file_cleanup
REM win98 wouldn't work like it should.  will be fixed for v1.
echo starting compression
FOR %%f in (*) DO shortn32 "%%f" "%shn_drive%:\%shn_path%\%1.shnf\%1_%%f.shn" > nul
echo compression complete

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:file_cleanup
FOR %%f in (*.) DO rename * *.wav
FOR %%f in (*.wav) DO move "%%f" "%wav_drive%:\%wav_path%\%%f" > nul
cd ..
if "%WINDIR%"=="C:\WINNT" rmdir /Q %temp_dir%
if "%WINDIR%"=="C:\WINDOWS" rmdir %temp_dir%
REM wow, why does microsoft break basic functionality between releases???

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:shn_md5_creation
cd %shn_drive%:\%shn_path%\%1.shnf
echo preparing shn_md5 checksum
FOR %%f in (*.shn) DO md5sum "%%f" >> "%shn_drive%:\%shn_path%\%1.shnf\%1_shn.md5"

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:dear_diary
echo %1 >> %shn_drive%:\%shn_path%\%1.shnf\%1_encode_notes.txt
echo.
if "%WINDIR%"=="C:\WINNT" for /f %%a in ('TIME /T') do set Time=%%a
if "%WINDIR%"=="C:\WINNT" echo encoded on %DATE% @ %Time%m >> %shn_drive%:\%shn_path%\%1.shnf\%1_encode_notes.txt
echo by %your_name% (%your_email%) >> %shn_drive%:\%shn_path%\%1.shnf\%1_encode_notes.txt
echo audio extraction:  %your_gear% >> %shn_drive%:\%shn_path%\%1.shnf\%1_encode_notes.txt
echo. >> %shn_drive%:\%shn_path%\%1.shnf\%1_encode_notes.txt
echo. >> %shn_drive%:\%shn_path%\%1.shnf\%1_encode_notes.txt
echo %adjustable_slogan% >> %shn_drive%:\%shn_path%\%1.shnf\%1_encode_notes.txt

echo. >> %shn_drive%:\%shn_path%\%1.shnf\%1_encode_notes.txt
echo. >> %shn_drive%:\%shn_path%\%1.shnf\%1_encode_notes.txt
echo.
:: PLEASE DON'T MODIFY THE LINES BELOW; LET ME HAVE MY FIFTEN MINUTES O' FAME...
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> %shn_drive%:\%shn_path%\%1.shnf\%1_encode_notes.txt
echo created with shn2k, the shorten compression assistant for windows 2000 and beyond >> %shn_drive%:\%shn_path%\%1.shnf\%1_encode_notes.txt
echo written by peter w. king ([email protected]) >> %shn_drive%:\%shn_path%\%1.shnf\%1_encode_notes.txt
echo (c)2001 crabcollective productions >> %shn_drive%:\%shn_path%\%1.shnf\%1_encode_notes.txt
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> %shn_drive%:\%shn_path%\%1.shnf\%1_encode_notes.txt

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:compression_tool_or_virus???
REM if exist c:\winnt\system32\shn2k.bat copy /Y c:\winnt\system32\shn2k.bat %shn_drive%:\%shn_path%\%1.shnf\shn2k.bat > nul

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:confirm_and_rip

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:last_gasp
explorer %shn_drive%:\%shn_path%\%1.shnf
echo finished -- thanks for using shn2k!
echo.

:end

::CLOSING CREDITS
::the win9x code doesn't trap errors as gracefully as it does in w2k
::so you might end up with a screenful of 'path not found' msgs -- 
::but only if your variables are misconfigured.  :-)
::
::there are no other known issues.  it works.  i am satisfied, for now.
::
::over and out,
::
::pwk
::
::  TODO for v1.00
::  windows9x date/time stamping
::  return to original DOS directory?
::  menu driven
::  turbo mode !!!
::  extract mode
::  autogenerate confirmation.bat script that both confirms and extracts for recipients
Attached Images
File Type: jpg start-run-shn2k.jpg
( 14.2 KB, 25 views)
 
__________________
Checksums Demystified | ask for help in Technobabble

thetradersden.org | ttd recommended free software/freeware webring
shntool tlh eac foobar2000 spek audacity cdwave vlc

Quote:
Originally posted by oxymoron
Here you are in a place of permanent madness, be careful!
Reply With Quote Reply with Nested Quotes