{"id":16893110,"url":"https://github.com/wader/aes-arraybuffer","last_synced_at":"2026-03-03T07:46:37.660Z","repository":{"id":138879138,"uuid":"8239767","full_name":"wader/aes-arraybuffer","owner":"wader","description":"JavaScript AES and CBC implementation using ArrayBuffer","archived":false,"fork":false,"pushed_at":"2013-02-16T19:47:45.000Z","size":176,"stargazers_count":13,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-10T15:48:07.177Z","etag":null,"topics":["aes","arraybuffer","javascript"],"latest_commit_sha":null,"homepage":"http://wader.github.com/aes-arraybuffer/tests.html","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wader.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-02-16T18:32:12.000Z","updated_at":"2022-03-17T08:25:39.000Z","dependencies_parsed_at":"2023-03-13T02:32:56.041Z","dependency_job_id":null,"html_url":"https://github.com/wader/aes-arraybuffer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wader/aes-arraybuffer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wader%2Faes-arraybuffer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wader%2Faes-arraybuffer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wader%2Faes-arraybuffer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wader%2Faes-arraybuffer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wader","download_url":"https://codeload.github.com/wader/aes-arraybuffer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wader%2Faes-arraybuffer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30036200,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T06:58:30.252Z","status":"ssl_error","status_checked_at":"2026-03-03T06:58:15.329Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","arraybuffer","javascript"],"created_at":"2024-10-13T17:13:41.078Z","updated_at":"2026-03-03T07:46:37.623Z","avatar_url":"https://github.com/wader.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Description\n\nThis is a JavaScript AES and CBC implementation using ArrayBuffer. Why you would want that you might ask and the reason is that I wanted to do AES CBC crypto in a Chrome extension. I also wanted to make it reasonable fast (for being done in JavaScript) so the code might look a bit weird and it is also only optimized to run with Chrome v8.\n\nNote that if you read this in a future when the [WebCrypto standard](http://www.w3.org/2012/webcrypto/WebCryptoAPI/) is available in all browser you need to support I suggest that you use that instead.\n\n### Performance\n\n2008 MacBook, Chrome 24, 2 GHz Core 2 Duo, 1067Mhz DDR3:  \nEncrypt ~12.2 MB/s, Decrypt ~8.4 MB/s\n\n2011 MacBook Air, Chrome 24, 1.5 GHz Core i5, 1333Mhz DDR3:  \nEncrypt ~17.5 MB/s, Decrypt ~12.0 MB/s\n\nIf you want to benchmark yourself you can check the \"CBC AES-128 Benchmark\" test case in\nthe [unit tests](http://wader.github.com/aes-arraybuffer/tests.html).\n\n### Usage\n\n```JavaScript\n// make sure both aes.js and crypto.js is included  \nvar iv = new Uint8Array([\n  0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,\n  0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef\n]);\nvar key = new Uint8Array([\n  0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,\n  0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef\n]);\nvar input = new Uint8Array(123456);\n\n// pad input to be AES block size aligned and then encrypt  \nvar encrypted = Crypto.encrypt_aes_cbc(Crypto.pkcs_pad(input.buffer), key.buffer, iv.buffer);\n\n// decrypt and then remove pad bytes\nvar decrypted = Crypto.pkcs_unpad(Crypto.decrypt_aes_cbc(encrypted, key.buffer, iv.buffer));\n\n// decrypted is now a ArrayBuffer with same bytes as in input\n```\n\n### Possible improvements and TODOs\n\nTest if inverse equivalent cipher is faster. [crypto-js AES](http://crypto-js.googlecode.com/svn/tags/3.1/src/aes.js) seems to use that but haven't benchmarked their code yet.\n\nI should write a short journal of the optimization steps and tests done to end up with the current code. The short version is: use lookup tables, don't create new objects, unroll and inline functions yourself as the v8 optimizer seem hard to predict and has some default limits that is hard to fulfill.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwader%2Faes-arraybuffer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwader%2Faes-arraybuffer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwader%2Faes-arraybuffer/lists"}