Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def fileToHash(self, name):
- self.hash = 0
- self.name = name.upper()
- for j in range(len(self.name)):
- self.hash = (self.hash * 61 + ord(self.name[j])) - 32
- print self.hash
- return self.hash
- //output for "loc.dat":
- 44
- 2731
- 166626
- 10164200
- 620016236
- 37820990429
- 2307080416221
- ---
- int fileToHash(String name) {
- int hash = 0;
- name = name.toUpperCase();
- for (int j = 0; j < name.length(); j++) {
- hash = (hash * 61 + name.charAt(j)) - 32;
- System.out.println(hash);
- }
- return hash;
- }
- //output for "loc.dat":
- 44
- 2731
- 166626
- 10164200
- 620016236
- -833715235
- 682978269
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement