-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deploying to gh-pages from @ ed9ce75 🚀
- Loading branch information
1 parent
7b5a7ab
commit 62eeaae
Showing
4 changed files
with
528 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"metadata":{"kernelspec":{"name":"python3","display_name":"Python 3 (ipykernel)","language":"python"},"language_info":{"name":"python","version":"3.10.14","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":5,"nbformat":4,"cells":[{"id":"140cd709-3deb-4886-b2a5-10ec1d8eb689","cell_type":"markdown","source":"# Get your OpenAI token\nThis token is only active during the workshop session this morning. ","metadata":{}},{"id":"e2e98a7c-8b5a-4e65-9070-ad59c1621d60","cell_type":"code","source":"import base64\nimport os\nfrom cryptography.fernet import Fernet\nfrom cryptography.hazmat.primitives import hashes\nfrom cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC\nfrom getpass import getpass","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"id":"b00228c4-e4d9-4e20-82ed-f4593cf7dae7","cell_type":"code","source":"password = getpass(prompt='Enter your Password:').encode()\nsalt = b'\\x86;e\\x8e\\nr\\xe7I\\xcb\\x924[\\xd5\\xf8o/'\nkdf = PBKDF2HMAC(\n algorithm=hashes.SHA256(),\n length=32,\n salt=salt,\n iterations=480000,\n)\nkey = base64.urlsafe_b64encode(kdf.derive(password))\nf = Fernet(key)","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"id":"679f7f96-cfab-41a0-ac50-77f56e2839d3","cell_type":"code","source":"encrypted_data = 'gAAAAABm687lC-BFZEzabcDPgl9t_i8pW9IbAkYLHzTv1A_ivpIHpNTHBy83JZ2k1i_YxLAf7mvirIJuuh7zloij9acQjFRK9HZGBclvVFZrY9-u7oCPpFJ_DpBTPg8kywZOsvoIjRp4JlwGTA0utrkQiHyWVneVMZO1ZtpGWBW-Mo8nuA9yEhkkAyRVDH-J3BsflqMuovZw'","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"id":"d5c2c62c-b058-482f-90df-b3c5fa8d9a8a","cell_type":"markdown","source":"## Copy your OpenAI token below","metadata":{}},{"id":"4b624977-6034-47a6-9957-f93c51d7e8dc","cell_type":"code","source":"f.decrypt(encrypted_data.encode()).decode()","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"id":"cff9f747-8c05-4bbc-b921-d6d29e51a2f1","cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null}]} |
Oops, something went wrong.