From 40e892f813aca0c6f055714f2733d2dea6b77fe8 Mon Sep 17 00:00:00 2001
From: yisding <yi.s.ding@gmail.com>
Date: Wed, 3 Jan 2024 10:35:56 -0800
Subject: [PATCH] Oops adding back Alex's crypto changes

---
 packages/core/src/Node.ts | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/packages/core/src/Node.ts b/packages/core/src/Node.ts
index f967a188f..386c37b44 100644
--- a/packages/core/src/Node.ts
+++ b/packages/core/src/Node.ts
@@ -1,4 +1,4 @@
-import CryptoJS from "crypto-js";
+import { createHash } from "node:crypto";
 import path from "path";
 import { v4 as uuidv4 } from "uuid";
 
@@ -177,13 +177,13 @@ export class TextNode<T extends Metadata = Metadata> extends BaseNode<T> {
    * @returns
    */
   generateHash() {
-    const hashFunction = CryptoJS.algo.SHA256.create();
+    const hashFunction = createHash("sha256");
     hashFunction.update(`type=${this.getType()}`);
     hashFunction.update(
       `startCharIdx=${this.startCharIdx} endCharIdx=${this.endCharIdx}`,
     );
     hashFunction.update(this.getContent(MetadataMode.ALL));
-    return hashFunction.finalize().toString(CryptoJS.enc.Base64);
+    return hashFunction.digest("base64");
   }
 
   getType(): ObjectType {
-- 
GitLab