Hash algorithm/function for file names

I have a couple of instances where I want to create a files which are both stored on the drive and emailed to a user.

To be able to attach multiple files to an email and/or to be able to create a record in a table with a file column referring to the file, I need to switch off the time stamp in the file name.

I am not sure if it is a big problem but the file names then become very easy to guess. If a user gets a file called something lime โ€œjohm_report_25_may_2021.pdfโ€ it is not very hard to guess the files names for other reports.

Ideally, I would like to include a simple hash in the fileโ€™s name. That would make the system more secure as it would be impossible to guess the names (depending on the algorithm) but it would allow me to find the files again as long as i have the input for the hash.

I donโ€™t think there is a HASH() function in appsheet.

Has anyone done this and do you have a not too long formula for a hash that works?

0 3 839
3 REPLIES 3

Hi @Erik_Ferm Could you use your Key Column?
Like CONCATENATE([Key_Column] , "_" , [File_Name])

Or you build your own hash:

@Fabian

Using the key column is a good idea. It is not foolproof but it makes a bit harder to guess than just using names and dates etc.

To get around the need to turn off the timestamp, I have a column that creates and saves the filename and added the timestamp portion at that time. Below is the expression I use. The expression uses TODAY() and TIMENOW() functions but you could replace these with a [Date Added] column timestamp so that you can always re-construct the filename as a sort of hashing function.

SUBSTITUTE((CONCATENATE([Type], " ", [Frequency], "_", [Name], "_", YEAR(TODAY()),  
                          INDEX(LIST("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"),
                          MONTH(TODAY())),  DAY(TODAY()), "_", TIMENOW())), ":", "_")

NOTE: The substitute replaces colons with underscores as filenames cannot have colons.

Top Labels in this Space