Lines Matching refs:hash
1 # @ohos.file.hash (File Hash Processing)
3 The **FileHash** module implements hash processing on files.
12 import { hash } from '@kit.CoreFileKit';
33 ## hash.hash
35 hash(path: string, algorithm: string): Promise<string>
37 Calculates a hash value for a file. This API uses a promise to return the result.
48 | algorithm | string | Yes | Algorithm used to calculate the hash value. The value can be **md5**,…
54 …| Promise<string> | Promise used to return the hash value. The hash value is a hexadecimal s…
70 hash.hash(filePath, "sha256").then((str: string) => {
71 console.info("calculate file hash succeed:" + str);
73 …console.error("calculate file hash failed with error message: " + err.message + ", error code: " +…
77 ## hash.hash
79 hash(path: string, algorithm: string, callback: AsyncCallback<string>): void
81 Calculates a hash value for a file. This API uses an asynchronous callback to return the result.
92 | algorithm | string | Yes | Algorithm used to calculate the hash value. The …
93 …ncCallback<string> | Yes | Callback used to return the hash value obtained. The hash value …
109 hash.hash(filePath, "sha256", (err: BusinessError, str: string) => {
111 …console.error("calculate file hash failed with error message: " + err.message + ", error code: " +…
113 console.info("calculate file hash succeed:" + str);
117 ## hash.createHash<sup>12+</sup>
121 Creates a **HashStream** instance, which can be used to generate a message digest (a hash value) us…
129 | algorithm | string | Yes | Algorithm used to calculate the hash value. The value can be **md5**, …
151 // Create a hash stream.
152 const hs = hash.createHash('sha256');
159 const fileHash = await hash.hash(filePath, 'sha256');
185 // Create a hash stream.
186 const hs = hash.createHash('sha256');
209 // Create a hash stream.
210 const hs = hash.createHash('sha256');