{"id":26198234,"url":"https://github.com/anilsingh581/cryptojs","last_synced_at":"2025-12-16T07:02:55.223Z","repository":{"id":219760635,"uuid":"749844628","full_name":"anilsingh581/CryptoJS","owner":"anilsingh581","description":"Encrypt And Decrypt Password in Angular Using CryptoJS in Angular 17","archived":false,"fork":false,"pushed_at":"2024-01-29T14:22:35.000Z","size":20,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-12T02:51:27.435Z","etag":null,"topics":["angular","angular-cli","angular-cli17","angular17","decryption","encryption","encryption-decryption"],"latest_commit_sha":null,"homepage":"https://www.code-sample.com/","language":"HTML","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/anilsingh581.png","metadata":{"files":{"readme":"README.md","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-29T14:09:44.000Z","updated_at":"2024-05-28T08:55:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"061a6bfd-1b65-484a-b035-54be30132c99","html_url":"https://github.com/anilsingh581/CryptoJS","commit_stats":null,"previous_names":["anilsingh581/cryptojs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/anilsingh581/CryptoJS","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anilsingh581%2FCryptoJS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anilsingh581%2FCryptoJS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anilsingh581%2FCryptoJS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anilsingh581%2FCryptoJS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anilsingh581","download_url":"https://codeload.github.com/anilsingh581/CryptoJS/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anilsingh581%2FCryptoJS/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27760430,"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","status":"online","status_checked_at":"2025-12-16T02:00:10.477Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["angular","angular-cli","angular-cli17","angular17","decryption","encryption","encryption-decryption"],"created_at":"2025-03-12T02:51:02.930Z","updated_at":"2025-12-16T07:02:55.219Z","avatar_url":"https://github.com/anilsingh581.png","language":"HTML","readme":"Angular 17 Encrypting and Decrypting Data with Crypto-js\n\nFirst, let's install crypto-js in our Angular project using npm:\n\nnpm install crypto-js\nnpm i --save-dev @types/crypto-js\n\n\nWith crypto-js installed, we can import it into our Local Service (EncrDecrService):\n\nimport * as CryptoJS from 'crypto-js';\n\nNow we will add two encrypt and decrypt methods to handle encryption and decryption in our service class:\n\nimport { Injectable } from '@angular/core';\nimport * as CryptoJS from 'crypto-js';\n\n\n@Injectable({\n  providedIn: 'root'\n})\nexport class EncrDecrService {\n  //Private Key\n  key = \"encrypt!135790\";\n\n  //constructor\n  constructor() { }\n\n  //To encrypt input data\n  public encrypt(password: string): string {\n    return CryptoJS.AES.encrypt(password, this.key).toString();\n  }\n  \n  //To decrypt input data\n  public decrypt(passwordToDecrypt: string) {\n    return CryptoJS.AES.decrypt(passwordToDecrypt, this.key).toString(CryptoJS.enc.Utf8);\n  }\n\n}\n\n\nUsing this service in component class,\n\nimport { Component, inject } from '@angular/core';\nimport { UserinfoComponent } from '../userinfo/userinfo.component';\nimport { EncrDecrService } from '../encr-decr-service.service';\n\n@Component({\n  selector: 'app-user-list',\n  standalone: true,\n  imports: [UserinfoComponent],\n  templateUrl: './user-list.component.html',\n  styleUrl: './user-list.component.css'\n})\nexport class UserListComponent {\n   user= 'This is user list'\n   encrypt ='';\n   decripted='';\n   private _text = 'system!1233';\n\n\n   //Constructor\n   constructor(private encrDecrService: EncrDecrService) {}\n\n   ngOnInit(): void {\n    console.log('Password :' + this._text);\n\n    this.encrypt = this.encrDecrService.encrypt(this._text);    \n    console.log('Decrypted password data :', this.encrypt);\n\n    this.decripted = this.encrDecrService.decrypt(this.encrypt);\n    console.log('Encripted to Decrypted password data :', this.decripted);\n  }\n   \n}\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanilsingh581%2Fcryptojs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanilsingh581%2Fcryptojs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanilsingh581%2Fcryptojs/lists"}