Skip to content
This repository was archived by the owner on Apr 3, 2024. It is now read-only.

Commit e4d0696

Browse files
committed
Switch to sha1 and add a TODO.
1 parent 1761d0e commit e4d0696

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/agent/firebase-controller.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,10 @@ export class FirebaseController implements Controller {
133133

134134
// Calculate the debuggee id as the hash of the object.
135135
// This MUST be consistent across all debuggee instances.
136+
// TODO: JSON.stringify may provide different strings if labels are added
137+
// in different orders.
136138
const debuggeeHash = crypto
137-
.createHash('md5')
139+
.createHash('sha1')
138140
.update(JSON.stringify(debuggee))
139141
.digest('hex');
140142
this.debuggeeId = `d-${debuggeeHash.substring(0, 8)}`;

test/test-firebase-controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ describe('Firebase Controller', () => {
150150
describe('register', () => {
151151
it('should get a debuggeeId', done => {
152152
const db = new MockDatabase();
153-
// Debuggee Id is based on the md5 hash of the json representation of
153+
// Debuggee Id is based on the sha1 hash of the json representation of
154154
// the debuggee.
155-
const debuggeeId = 'd-e1662bd7';
155+
const debuggeeId = 'd-b9dbb5e7';
156156
const controller = new FirebaseController(
157157
db as {} as firebase.database.Database
158158
);

0 commit comments

Comments
 (0)