Skip to content

Commit f5e54b9

Browse files
committed
fix: added missing encoding for password
1 parent 4cfa12f commit f5e54b9

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/components/Footer/Footer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { FunctionComponent } from 'react';
22

33
export const Footer: FunctionComponent = () => {
44
return <>
5-
<footer className="my-2 pt-2 text-muted text-center text-small">
5+
<footer className="my-2 pt-2 text-white text-center text-small">
66
Made with <span role="img" aria-label="heart"></span>️ and <span role="img" aria-label="coffee">☕️</span>
77
<br/>
88
<span role="img">©</span> 2019 - 2023 <a target={'_blank'} rel={'noreferrer'} href={'https://www.rinne.info/'}>

src/services/generateHash.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,10 @@ describe('generateHash', () => {
1414

1515
expect(result).toBe('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855');
1616
});
17+
18+
it('should return a valid string with special characters', () => {
19+
const result = generateHash('foo', '<html#>', 'baz');
20+
21+
expect(result).toBe('b7385df3b782339b66400089d41a142d4e007d84c94fb68397d7f4fb82e74f9b');
22+
});
1723
});

src/services/generateHash.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { Buffer } from 'buffer';
1515
* @param salt
1616
*/
1717
export const generateHash = (userName: string, password: string, salt: string) => {
18-
const uint8array = new TextEncoder().encode(password + salt + userName);
18+
const uint8array = new TextEncoder().encode(encodeURI(password) + salt + userName);
1919
const hash = new sha256.Hash();
2020

2121
hash.update(uint8array);

0 commit comments

Comments
 (0)