mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 04:16:17 +01:00 
			
		
		
		
	use native concat instead of own reimplementation
This commit is contained in:
		@@ -185,10 +185,10 @@ const encryption = (function() {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function encrypt(aes, str) {
 | 
					    function encrypt(aes, str) {
 | 
				
			||||||
        const payload = aesjs.utils.utf8.toBytes(str);
 | 
					        const payload = Array.from(aesjs.utils.utf8.toBytes(str));
 | 
				
			||||||
        const digest = sha256Array(payload).slice(0, 4);
 | 
					        const digest = sha256Array(payload).slice(0, 4);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const digestWithPayload = concat(digest, payload);
 | 
					        const digestWithPayload = digest.concat(payload);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const encryptedBytes = aes.encrypt(digestWithPayload);
 | 
					        const encryptedBytes = aes.encrypt(digestWithPayload);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -220,20 +220,6 @@ const encryption = (function() {
 | 
				
			|||||||
        return payload;
 | 
					        return payload;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function concat(a, b) {
 | 
					 | 
				
			||||||
        const result = [];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        for (let key in a) {
 | 
					 | 
				
			||||||
            result.push(a[key]);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        for (let key in b) {
 | 
					 | 
				
			||||||
            result.push(b[key]);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return result;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    function sha256Array(content) {
 | 
					    function sha256Array(content) {
 | 
				
			||||||
        const hash = sha256.create();
 | 
					        const hash = sha256.create();
 | 
				
			||||||
        hash.update(content);
 | 
					        hash.update(content);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user