Changes

Jump to navigation Jump to search
→‎Example: add python
Line 18: Line 18:  
''R.E.Searcher@socsci.ru.nl''
 
''R.E.Searcher@socsci.ru.nl''
 
=== Example ===
 
=== Example ===
 +
==== Online ====
 
Try this [https://www.socsci.ru.nl/wilberth/computer/pic.html calculator] to make these checksums yourself.
 
Try this [https://www.socsci.ru.nl/wilberth/computer/pic.html calculator] to make these checksums yourself.
   −
If you install the [https://extensions.openoffice.org/en/project/cryptographic-hash-functions-uno-component-openofficeorg cryptographic hash] extension to Open Office/ Libre Office you can use [https://www.socsci.ru.nl/wilberth/nocms/computer/pic.ods this document] to calculate PIC. You may have to enable macros for it to work.
+
==== OpenOffice / LibreOffice ====
[[File:PIC libre office.png|frame|Calculating Participant Identification Code in Libre Office]]
+
If you install the [https://extensions.openoffice.org/en/project/cryptographic-hash-functions-uno-component-openofficeorg cryptographic hash] extension to OpenOffice/ LibreOffice you can use [https://www.socsci.ru.nl/wilberth/nocms/computer/pic.ods this document] to calculate PIC. You may have to enable macros for it to work.
 +
[[File:PIC libre office.png|frame|Calculating Participant Identification Code in LibreOffice]]
    +
==== Google Sheets ====
 
You can also calculate the PICs with this [https://docs.google.com/spreadsheets/d/18jmxpui2rr3dShySQiyn06kX36cCHHGRgan2MGGXjlo/edit?usp=sharing Google Sheet].
 
You can also calculate the PICs with this [https://docs.google.com/spreadsheets/d/18jmxpui2rr3dShySQiyn06kX36cCHHGRgan2MGGXjlo/edit?usp=sharing Google Sheet].
 +
 +
==== Python 3 ====
 +
In Python 3 you can easily calculate pic. Note that the secret and the ppn must be strings.
 +
 +
#!/usr/bin/env/python3
 +
secret = "mySecret123!"
 +
ppn = "0"
 +
pic = hashlib.sha256(secret.encode('utf-8')+ppn.encode('utf-8')).hexdigest()[0:4].upper()
 +
print(pic)
    
== Rationale ==
 
== Rationale ==

Navigation menu