├── .gitignore ├── README.md ├── index.js ├── .npmrc ├── package.json ├── test.js ├── .github └── workflows │ └── npm-publish-github-packages.yml └── encryptor.js /.gitignore: -------------------------------------------------------------------------------- 1 | .npmrc/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # hashcode 2 | # custom-decryptor 3 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const CustomEncryptor = require('./encryptor'); 2 | 3 | 4 | 5 | module.exports = CustomEncryptor; 6 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | @azamjonbro:registry=https://npm.pkg.github.com/ 2 | //npm.pkg.github.com/:_authToken=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 3 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@azamjonbro/custom-decryptor", 3 | "version": "1.0.1", 4 | "description": "Custom decryption module", 5 | "main": "decryptor.js", 6 | "type": "commonjs", 7 | "scripts": { 8 | "start": "node index.js" 9 | }, 10 | "keywords": [], 11 | "author": "Azamjonbro", 12 | "license": "MIT", 13 | "publishConfig": { 14 | "registry": "https://npm.pkg.github.com/" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test.js: -------------------------------------------------------------------------------- 1 | const CustomEncryptor = require("./encryptor"); 2 | 3 | const encryptor = new CustomEncryptor(); 4 | 5 | const hashedPassword = encryptor.encrypt("mongodb://SupperAdminBek:Azamjonazooz12%40bro@91.222.239.5:27017/Backery?authSource=admin&directConnection=true"); 6 | console.log("Stored Hash:", hashedPassword); 7 | 8 | const isValid = encryptor.verify("mongodb://SupperAdminBek:Azamjonazooz12%40bro@91.222.239.5:27017/Backery?authSource=admin&directConnection=true", hashedPassword); 9 | console.log("Password Correct?", isValid); 10 | -------------------------------------------------------------------------------- /.github/workflows/npm-publish-github-packages.yml: -------------------------------------------------------------------------------- 1 | # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created 2 | # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages 3 | 4 | name: Node.js Package 5 | 6 | on: 7 | release: 8 | types: [created] 9 | 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v4 15 | - uses: actions/setup-node@v4 16 | with: 17 | node-version: 20 18 | - run: npm ci 19 | - run: npm test 20 | 21 | publish-gpr: 22 | needs: build 23 | runs-on: ubuntu-latest 24 | permissions: 25 | contents: read 26 | packages: write 27 | steps: 28 | - uses: actions/checkout@v4 29 | - uses: actions/setup-node@v4 30 | with: 31 | node-version: 20 32 | registry-url: https://npm.pkg.github.com/ 33 | - run: npm ci 34 | - run: npm publish 35 | env: 36 | NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} 37 | -------------------------------------------------------------------------------- /encryptor.js: -------------------------------------------------------------------------------- 1 | class CustomEncryptor { 2 | constructor() { 3 | this.secretKey = "Pizdessannaxuyhuyyechasansekretkeyimni"; 4 | this.alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" 5 | + "АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюя" 6 | + "ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρστυφχψω" 7 | + "ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىي" 8 | + "!@#$%^&*()-_=+[]{}|;:'\",.<>?/`~"; 9 | } 10 | 11 | encrypt(data) { 12 | let encrypted = ''; 13 | for (let i = 0; i < data.length; i++) { 14 | let charCode = data.charCodeAt(i) ^ this.secretKey.charCodeAt(i % this.secretKey.length); 15 | encrypted += this.alphabet[charCode % this.alphabet.length]; 16 | } 17 | return encrypted; 18 | } 19 | 20 | decrypt(encryptedData) { 21 | let decrypted = ''; 22 | for (let i = 0; i < encryptedData.length; i++) { 23 | let charCode = this.alphabet.indexOf(encryptedData[i]); 24 | let originalChar = String.fromCharCode(charCode ^ this.secretKey.charCodeAt(i % this.secretKey.length)); 25 | decrypted += originalChar; 26 | } 27 | return decrypted; 28 | } 29 | 30 | // ✅ `verify` methodini qo‘shamiz 31 | verify(originalData, hashedData) { 32 | const decrypted = this.decrypt(hashedData); 33 | return decrypted === originalData; // Tekshirish 34 | } 35 | } 36 | 37 | module.exports = CustomEncryptor; 38 | --------------------------------------------------------------------------------