{"id":25533516,"url":"https://github.com/Coderad32/SigilKeyMap","last_synced_at":"2026-01-24T21:30:16.607Z","repository":{"id":254700882,"uuid":"847301288","full_name":"Coderad32/Tokens","owner":"Coderad32","description":"(prebuild) Information system","archived":false,"fork":false,"pushed_at":"2025-01-28T20:52:30.000Z","size":58,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-20T02:43:54.408Z","etag":null,"topics":["code","open","project","rebuild","token"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Coderad32.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-25T12:41:46.000Z","updated_at":"2025-01-28T20:52:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"d83e5ea5-ca83-4de2-ad42-3295c032db7b","html_url":"https://github.com/Coderad32/Tokens","commit_stats":null,"previous_names":["cody-p2p/codestoken","cody-p2p/tokens","coderad32/tokens"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coderad32%2FTokens","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coderad32%2FTokens/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coderad32%2FTokens/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coderad32%2FTokens/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Coderad32","download_url":"https://codeload.github.com/Coderad32/Tokens/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239768925,"owners_count":19693760,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code","open","project","rebuild","token"],"created_at":"2025-02-20T02:44:01.428Z","updated_at":"2026-01-24T21:30:16.532Z","avatar_url":"https://github.com/Coderad32.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Import the necessary libraries\nIF you wish to use this code please feel free with this project.\n\n```\n// SPDX-License-Identifier: MIT\n// Compatible with OpenZeppelin Contracts ^5.0.0\npragma solidity ^0.8.22;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol\";\n\ncontract MyToken is ERC20, ERC20Permit {\n    constructor() ERC20(\"MyToken\", \"MTK\") ERC20Permit(\"MyToken\") {}\n}\n```\n\n```\nimport hashlib\nimport time\nimport json\n```\n## Define the token class\n```\nclass Token:\n    def __init__(self, user_id, expires_in=3600):\n        self.user_id = user_id\n        self.expires_in = expires_in\n        self.token = self.generate_token()\n\n    def generate_token(self):\n        # Generate a random token using a hash function\n        token = hashlib.sha256((str(self.user_id) + str(int(time.time()))).encode()).hexdigest()\n        return token\n\n    def verify_token(self, token):\n        # Verify the token by checking if it matches the generated token\n        if token == self.token:\n            return True\n        return False\n\n    def get_user_id(self):\n        return self.user_id\n```\n## Create a token for a user\n```\nuser_id = 123\ntoken = Token(user_id)\n```\n\n## Print the token\n```\nprint(\"Token:\", token.token)\n```\n## Verify the token\n```\nprint(\"Is token valid?\", token.verify_token(token.token))\n```\n## Try to verify an invalid token\n```\nprint(\"Is invalid token valid?\", token.verify_token(\"invalid_token\"))\n```\n## Get the user ID from the token\n```\nprint(\"User ID:\", token.get_user_id())\n```\n## Token expiration\n```\nprint(\"Token expires in:\", token.expires_in, \"seconds\")\n```\n## Simulate token expiration\n```\ntime.sleep(token.expires_in)\nprint(\"Token still valid?\", token.verify_token(token.token))  # Should be False\n```\n## Create a new token with a new expiration time\n```\nnew_token = Token(user_id, expires_in=7200)\nprint(\"New token:\", new_token.token)\nprint(\"New token expires in:\", new_token.expires_in, \"seconds\")\n```\n\n```\nimport hashlib\nimport binascii\n```\n## # Define a function to hash a string using different algorithms\n```\ndef hash_string(s, algorithm):\n    if algorithm == \"md5\":\n        return hashlib.md5(s.encode()).hexdigest()\n    elif algorithm == \"sha1\":\n        return hashlib.sha1(s.encode()).hexdigest()\n    elif algorithm == \"sha256\":\n        return hashlib.sha256(s.encode()).hexdigest()\n    elif algorithm == \"sha512\":\n        return hashlib.sha512(s.encode()).hexdigest()\n    else:\n        return \"Invalid algorithm\"\n```\n## Test the function with different strings and algorithms\n```\nstrings = [\"hello\", \"world\", \"python\"]\nalgorithms = [\"md5\", \"sha1\", \"sha256\", \"sha512\"]\n\nfor s in strings:\n    for algorithm in algorithms:\n        print(f\"{s} hashed with {algorithm}: {hash_string(s, algorithm)}\")\n```\n## Example usage: hash a string using MD5\n```\nhashed_string = hash_string(\"hello\", \"md5\")\nprint(f\"Hashed string: {hashed_string}\")\n```\n# Example usage: hash a string using SHA-256\n```\nhashed_string = hash_string(\"hello\", \"sha256\")\nprint(f\"Hashed string: {hashed_string}\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCoderad32%2FSigilKeyMap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCoderad32%2FSigilKeyMap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCoderad32%2FSigilKeyMap/lists"}