Skip to content

Commit 5015185

Browse files
committed
BF: make anonymize_script actually output anything and map determinstically
hash() would get a new value for every run for the same sid, so not a good choice. Without print script produced no output so code just saw empty string and assumed that no annonymization was needed etc
1 parent 8866cc5 commit 5015185

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

heudiconv/tests/anonymize_script.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
import sys
44
import re
5-
import ctypes
5+
import hashlib
66

77

88
def bids_id_(sid):
99
parsed_id = re.compile(r"^(?:sub-|)(.+)$").search(sid).group(1)
10-
return str(ctypes.c_size_t(hash(parsed_id)).value)
10+
return hashlib.md5(parsed_id.encode()).hexdigest()[:8]
1111

1212

1313
def main():
@@ -16,4 +16,4 @@ def main():
1616

1717

1818
if __name__ == '__main__':
19-
main()
19+
print(main())

0 commit comments

Comments
 (0)