{"id":15040914,"url":"https://github.com/simbiose/encryption","last_synced_at":"2025-04-05T23:08:30.934Z","repository":{"id":20225346,"uuid":"23497144","full_name":"simbiose/Encryption","owner":"simbiose","description":"Encryption is a simple way to encrypt and decrypt strings on Android and Java project.","archived":false,"fork":false,"pushed_at":"2018-10-31T01:51:04.000Z","size":320,"stargazers_count":358,"open_issues_count":9,"forks_count":76,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-03-29T22:06:37.548Z","etag":null,"topics":["android","decrypt-strings","encryption","java","kotlin","kotlin-android"],"latest_commit_sha":null,"homepage":"","language":"Java","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/simbiose.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}},"created_at":"2014-08-30T17:39:26.000Z","updated_at":"2025-03-07T21:25:44.000Z","dependencies_parsed_at":"2022-07-27T16:33:28.026Z","dependency_job_id":null,"html_url":"https://github.com/simbiose/Encryption","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simbiose%2FEncryption","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simbiose%2FEncryption/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simbiose%2FEncryption/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simbiose%2FEncryption/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simbiose","download_url":"https://codeload.github.com/simbiose/Encryption/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247411234,"owners_count":20934653,"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":["android","decrypt-strings","encryption","java","kotlin","kotlin-android"],"created_at":"2024-09-24T20:45:16.797Z","updated_at":"2025-04-05T23:08:30.904Z","avatar_url":"https://github.com/simbiose.png","language":"Java","readme":"Encryption\n=====================\n\nEncryption is a simple way to encrypt and decrypt strings on Android and Java project.\n\n[![](https://jitpack.io/v/simbiose/Encryption.svg)](https://jitpack.io/#simbiose/Encryption) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-encryption-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/935) [![Build Status](https://www.bitrise.io/app/fc607e87ae734d03/status.svg?token=dtlsgmtrxOrDdVqdtaxK-g\u0026branch=master)](https://www.bitrise.io/app/fc607e87ae734d03) [![Build Status](https://semaphoreci.com/api/v1/projects/f74e04e6-bd08-4faa-ba77-a5ee51d0f82e/680132/badge.svg)](https://semaphoreci.com/ademar111190/encryption)\n\n## How to use ##\n\n1º Add [JitPack](https://jitpack.io/) to your build file\n```\nallprojects {\n  repositories {\n    ...\n    maven { url 'https://jitpack.io' }\n  }\n}\n```\n\n2º Add the gradle dependency\n```\ncompile 'com.github.simbiose:Encryption:2.0.1'\n```\n\n3º Get an Encryption instance\n```\nString key = \"YourKey\";\nString salt = \"YourSalt\";\nbyte[] iv = new byte[16];\nEncryption encryption = Encryption.getDefault(key, salt, iv);\n```\n\n4º Encrypt your text\n```\nString encrypted = encryption.encryptOrNull(\"Text to be encrypt\");\n```\n\n5º Decrypt your text\n```\nString decrypted = encryption.decryptOrNull(encrypted);\n```\n\n## Custom usage ##\n\nYou can use you own builder\n```\nEncryption encryption = new Encryption.Builder()\n                .setKeyLength(128)\n                .setKey(\"YourKey\")\n                .setSalt(\"YourSalt\")\n                .setIv(yourByteIvArray)\n                .setCharsetName(\"UTF8\")\n                .setIterationCount(1)\n                .setDigestAlgorithm(\"SHA1\")\n                .setBase64Mode(Base64.DEFAULT)\n                .setAlgorithm(\"AES/CBC/PKCS5Padding\")\n                .setSecureRandomAlgorithm(\"SHA1PRNG\")\n                .setSecretKeyType(\"PBKDF2WithHmacSHA1\")\n                .build();\n```\n\nSee more on Examples folder, there is an Android, a Java and a Kotlin project.\n\n## FAQ ##\n\n - What is Encryption library?\n\t - Encryption library is an Open Source library to help encryption routines in Android and Java applications, our target is to be simple and secure.\n - What is the \"IV\", what should be my `yourByteIvArray`\n\t - Encryption 1.2+ uses by default the AES algorithm in CBC mode, so to encrypt and decrypt works you should have the same key and the same IV byte array to encrypt and to decrypt. An example of IV is `byte[] iv = {-89, -19, 17, -83, 86, 106, -31, 30, -5, -111, 61, -75, -84, 95, 120, -53};` like you can see, 16 bytes in a byte array. So if you want to use this library I recommend you create you own IV and save it :floppy_disk:.\n - I Don't like null returns when errors occurs, what to do to handle errors?\n\t - You have the power to handle the exceptions, instead of uses `encryptOrNull` method just uses the `encrypt` method. The same for the `decryptOrNull`, just uses the `decrypt` method.\n - I'm getting problems with main thread, what to do?\n\t - Encrypt routines can take time, so you can uses the `encryptAsync` with a `Encryption.Callback`to avoid ANR'S. The same for `decryptAsync`\n - I'm an older user, version 1.4 or less, what to do to update Encrypt to version 2.+?\n     - The library has changed the default iteration count from 65536 to 1, it improve the performance, if you have a code using the old version or if you prefer to use a big iteration count you just need to use a custom builder instead of get the default builder and set the iteration count you want\n     - As far as the library uses 1 as default iteration count we do not need anymore the getLowIteration and it was removed from project, if you use it you can just change to getDefault\n     - MIT is the project license so feel free to use it :tada:\n - I'm a very older user, version 1.1 or less, what to do to update Encrypt to version 1.2+?\n\t - The library has several changes in his structure in version 1.2, both in algorithm and in code usage, so if you are an older user you need migrate the encrypted stuff or configure the `Builder` manually to the same parameters used in version 1.1 and olds.\n\n\n### Want to contribute? ###\n\nFell free to contribute, We really like pull requests :octocat:\n\n\n#### Third part ####\n\n- Copyright (C) 2010 The Android Open Source Project, applied to:\n\t- Base64 (third.part.android.util.Base64) original comes from [here](https://github.com/android/platform_frameworks_base/blob/ab69e29c1927bdc6143324eba5ccd78f7c43128d/core/java/android/util/Base64.java)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimbiose%2Fencryption","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimbiose%2Fencryption","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimbiose%2Fencryption/lists"}