{"id":20878696,"url":"https://github.com/codingfries/aes_crypt_null_safe","last_synced_at":"2025-05-12T16:31:06.787Z","repository":{"id":45411044,"uuid":"412468592","full_name":"CodingFries/aes_crypt_null_safe","owner":"CodingFries","description":"Flutter Package for Encryption \u0026 Decryption - With added Null Safety - Created using Flutter Framework and Dart Language","archived":false,"fork":false,"pushed_at":"2024-05-15T17:24:00.000Z","size":349,"stargazers_count":7,"open_issues_count":4,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-01T08:12:16.138Z","etag":null,"topics":["aes","dart","encryption"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/aes_crypt_null_safe","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CodingFries.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2021-10-01T13:02:38.000Z","updated_at":"2025-02-03T21:49:23.000Z","dependencies_parsed_at":"2024-11-18T07:14:01.642Z","dependency_job_id":"b828313f-a48f-4c40-b596-e70e079b75ac","html_url":"https://github.com/CodingFries/aes_crypt_null_safe","commit_stats":{"total_commits":71,"total_committers":2,"mean_commits":35.5,"dds":0.07042253521126762,"last_synced_commit":"e2e9c4fbd5a363fb99a74d7ced67e7b7ed85c5c9"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodingFries%2Faes_crypt_null_safe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodingFries%2Faes_crypt_null_safe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodingFries%2Faes_crypt_null_safe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodingFries%2Faes_crypt_null_safe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CodingFries","download_url":"https://codeload.github.com/CodingFries/aes_crypt_null_safe/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253776755,"owners_count":21962549,"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":["aes","dart","encryption"],"created_at":"2024-11-18T07:13:51.634Z","updated_at":"2025-05-12T16:31:06.408Z","avatar_url":"https://github.com/CodingFries.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# aes_crypt \n\n# Note\n\nThis package is a fork of\n\nhttps://pub.dev/packages/aes_crypt\n\nwith added null safety.\n\nI reserve no rights to any of the content.\nHopefully you don't sue me or anything :D I'm just trynna make this package null safe :)\n\n## Introduction\n\naes_crypt is a library for Dart and Flutter developers that uses 256-bit AES algorithm \nto encrypt/decrypt files, plain text and binary data. It is fully compatible with the \n[AES Crypt](https://www.aescrypt.com/) file format.\nIt can be used to integrate AES Crypt functionality into your own Dart or Flutter applications.\nAll algorithms are implemented in pure Dart and work in all platforms.\n\naes_crypt writes and reads version 2 (latest) of the AES Crypt file specification. Backwards compatibility \nwith reading the version 1 is implemented but untested. \nOutput .aes files are fully compatible with any software using the AES Crypt standard file format. \nThis library is accompanied by clients and libraries for different operating systems\nand programming languages.\nFor more information about AES Crypt and AES Crypt compatible \napplications for other platforms, please visit [AESCrypt's official website](https://www.aescrypt.com).  \n \n## Features\n\n- 256-bit AES encryption format.\n- File-to-file encryption and decryption.\n- Memory-to-file encryption, file-to-memory decryption.\n- Password can be in Unicode (like \"密碼 パスワード пароль كلمة السر\").\n- Support for asynchronous file system reading/writing.\n- Encrypted files have .aes extension which clients on other operating systems recognize.\n- Compatible software available for Windows, Linux, Mac OS, Android and iOS \n(https://www.aescrypt.com/download/).\n\n## Usage\n\nIn your Dart code add the following import:\n```dart\nimport 'dart:typed_data';\nimport 'package:aes_crypt/aes_crypt_null_safe.dart';\n```\n\nInitialization:\n```dart\nvar crypt = AesCrypt('my cool password');\n```\nor\n```dart\nvar crypt = AesCrypt();\ncrypt.setPassword('my cool password');\n```\n\nOptionally you can set overwrite mode for the file write operations:\n```dart\n// Overwrites the file if it exists.\ncrypt.setOverwriteMode(AesCryptOwMode.on);\n\n// If the file exists, stops the operation and throws 'AesCryptException'\n// exception with 'AesCryptExceptionType.destFileExists' type (see \n// example1.dart in 'example'  folder). This mode is set by default.\ncrypt.setOverwriteMode(AesCryptOwMode.warn);\n\n// If the file exists, adds index '(1)' to its' name and tries to save. \n// If such file also exists, adds '(2)' to its name, then '(3)', etc. \ncrypt.setOverwriteMode(AesCryptOwMode.rename);\n```\n\n*Notice: All functions having 'Sync' at the end of their names are synchronous.\nIf you need asynchronous ones, please just remove 'Sync' from the end of function name.*\n\n\nFile encryption/decryption:\n```dart\n// Encrypts the file srcfile.txt and saves encrypted file under original name \n// with '.aes' extention added (srcfile.txt.aes). You can specify relative or \n// direct path to it. To save the file into current directory specify it \n// either as './srcfile.txt' or as 'srcfile.txt'.\ncrypt.encryptFileSync('srcfile.txt');\n\n// Encrypts the file srcfile.txt and saves encrypted file under \n// the name enc_file.txt.aes\ncrypt.encryptFileSync('srcfile.txt', 'enc_file.txt.aes');\n\n// Decrypts the file srcfile.txt.aes and saves decrypted file under \n// the name srcfile.txt\ncrypt.decryptFileSync('srcfile.txt.aes');\n\n// Decrypts the file srcfile.txt.aes and saves decrypted file under \n// the name dec_file.txt\ncrypt.decryptFileSync('srcfile.txt.aes', 'dec_file.txt');\n```\n\nText \u003c=\u003e file encryption/decryption:\n```dart\nString decryptedText;\n\n// Plain text to be encrypted\nString srcText = 'some text';\n\n// Encrypts the text as UTF8 string and saves it into 'mytext.txt.aes' file.\ncrypt.encryptTextToFileSync(srcText, 'mytext.txt.aes');\n// Encrypts the text as UTF16 Big Endian string and saves it \n// into 'mytext.txt.aes' file.\ncrypt.encryptTextToFileSync(srcText, 'mytext.txt.aes', utf16: true);\n// Encrypts the text as UTF16 Little Endian string and saves it \n// into 'mytext.txt.aes' file.\ncrypt.encryptTextToFileSync(srcText, 'mytext.txt.aes', utf16: true, endian: Endian.little);\n// Add 'bom: true' as an argument if you want to add byte order mark \n// at the beginning of the text string before the encryption. For example:\n// crypt.encryptTextToFileSync(srcText, 'mytext.txt.aes', bom: true);\n\n// Decrypts the file and interprets it based on byte order mark if it has one.\n// Otherwise it will be interpreted as UTF8 text.\ndecryptedString = crypt.decryptTextFromFileSync('mytext.txt.aes');\n// Decrypts the file and interprets it based on byte order mark if it has one.\n// Otherwise it will be interpreted as UTF16 Big Endian text.\ndecryptedString = crypt.decryptTextFromFileSync('mytext.txt.aes', utf16: true);\n// Decrypts the file and interprets it based on byte order mark if it has one.\n// Otherwise it will be interpreted as UTF16 Little Endian text.\ndecryptedString = crypt.decryptTextFromFileSync('mytext.txt.aes', utf16: true, endian: Endian.little);\n\n```\n\nBinary data \u003c=\u003e file encryption/decryption:\n```dart\n// Binary data to be encrypted\nUint8List srcData = Uint8List.fromList([1,2,3,4,5]);\n\n// Encrypts the data and saves it into mydata.bin.aes file.\ncrypt.encryptDataToFileSync(srcData, 'mydata.bin.aes');\n\n// Decrypt the data from 'mydata.bin.aes' file\nUint8List decryptedData = crypt.decryptDataFromFileSync('mydata.bin.aes');\n```\n\nBinary data AES encryption/decryption:\n```dart\n// The encryption key. It should be 128, 192 or 256 bits long.\nUint8List key = Uint8List.fromList([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]);\n\n// The initialization vector used in advanced cipher modes. \n// It must be 128 bits long.\nUint8List iv = Uint8List.fromList([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]);\n\n// AES mode of operation. It can be one of the next values:\n//    AesMode.ecb - ECB (Electronic Code Book)\n//    AesMode.cbc - CBC (Cipher Block Chaining)\n//    AesMode.cfb - CFB (Cipher Feedback)\n//    AesMode.ofb - OFB (Output Feedback)\n// By default the mode is AesMode.cbc\nAesMode mode = AesMode.cbc; // Ok. I know it's meaningless here.\n\n// Sets the encryption key and IV.\ncrypt.aesSetKeys(key, iv);\n// Sets cipher mode\ncrypt.aesSetMode(mode);\n\n// If you wish you can set the key, IV and cipher mode in one function.\n//crypt.aesSetParams(key, iv, mode);\n\n// The binary data to be encrypted\nUint8List srcData = Uint8List.fromList([1,2,3,4,5]);\n\n// Encrypts the data. Padding scheme - null byte (0x00).\nUint8List encryptedData = crypt.aesEncrypt(srcData);\n// Decrypts the data\nUint8List decryptedData = crypt.aesDecrypt(encryptedData);\n```\n\nSHA256 and HMAC-SHA256 computation:\n```dart\n// The source data\nUint8List srcData = Uint8List.fromList([1,2,3,4,5,6,7,8,9]);\n\n// Computes SHA256 hash\nUint8List hash = crypt.sha256(srcData);\n\n// Secret cryptographic key for HMAC\nUint8List key = Uint8List.fromList([1,2,3]);\n\n// Computes HMAC-SHA256 code\nUint8List hmac = crypt.hmacSha256(key, srcData);\n```\n\n## Acknowledgments\n\n- to Phil Nicholls for [PHP-AES-File-Encryption library](https://github.com/philios33/PHP-AES-File-Encryption) \n- to IgoAtM for [PHP aesCrypt complient class](https://forums.packetizer.com/viewtopic.php?f=72\u0026t=403)\n- to author of [phpAES](http://www.phpaes.com) library ([github](https://github.com/phillipsdata/phpaes))\n- to authors of [phpseclib](http://phpseclib.sourceforge.net/) ([github](https://github.com/phpseclib/phpseclib))\n- to Steven Roose for [pointycastle](https://pub.dev/packages/pointycastle) Dart library ([github](https://github.com/PointyCastle/pointycastle))\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodingfries%2Faes_crypt_null_safe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodingfries%2Faes_crypt_null_safe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodingfries%2Faes_crypt_null_safe/lists"}