How does the algorithm for hashing the files look like?

If you upload a file over the api to a seafile server you will get in response a file id. This id stays the same for a unique file so I suspect this to be a hash. To do some checks in my application I would like to see the algorithm which creates the hashes. I assume the code is probably in the seafile-server repository?

Thanks in advance

Hi GGrove,

welcome to the Seafile Community Forum!

I am not a Seafile developer, but I know a bit about the way Seafile works.

Seafile uses a data model very similar to Git. Git uses SHA1 hashes. As a consequence, I would assume that Seafile also uses SHA1 hashes. In fact, I would be very surprised if it wasn’t SHA1.


Thanks for the answer!
I created already several hashes of this exact same file with a lot of hashing algorithims and none of these matched. The length of the seafile hash though matches SHA1. So there is probably a salt to that hash or another appendage to the file

Hi again,
there is certainly no salt used. This would make no sense at this point. Git uses hashes not for security but for identification purposes.
Keep in mind that a file’s hash changes if only one bit is changed. I am saying this because I am not sure which part of the file is hashed - all including metadata, only file content, file content including some meta data. If you find out, please post here. I would be interested.

I think it would be very useful if someone could guide us where to find the exact code lines for the algorithm. Maybe one of the developers are in this forum and give us some insight?

The source code lays wide open. It is up for grabs. Calling for the developers is not the right thing to do.

If you found the answer, please post it here - the Seafile Community Forum - for future reference.

I think the code for the hashing is in this repository: But I’m not an expert in C and I didn’t find anything when I first looked through the code.