From 40346ec8f89c1152f78f7356a4137d7f488d1f59 Mon Sep 17 00:00:00 2001 From: liujia178 Date: Thu, 17 Apr 2025 17:02:08 +0800 Subject: [PATCH] Add ArkTS SDK getHash Issue: https://gitee.com/openharmony/commonlibrary_ets_utils/issues/IC1V6Q?from=project-issue Signed-off-by: liujia178 --- sdk/api/@ohos.util.ets | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sdk/api/@ohos.util.ets b/sdk/api/@ohos.util.ets index 1d78c433..5dada93e 100644 --- a/sdk/api/@ohos.util.ets +++ b/sdk/api/@ohos.util.ets @@ -1040,4 +1040,14 @@ export namespace util { private static native doEncodeInfoUint8Array( input: string, inputEncoding: string, destArray: Uint8Array): EncodeIntoUint8ArrayInfo; } + + /** + * Get the hash code of an object. + * @param { object } [object] - The object that need to get hash code. + * @returns { number } Return a hash code of an object. + */ + export function getHash(obj: object): number { + let result: number = obj.$_hashCode(); + return result; + } } // namespace Util \ No newline at end of file -- Gitee