目录

@performance/crypto-replacement-check

For most APIs provided by the third-party library @ohos/crypto-js, if the SDK has the corresponding built-in system implementation (@ohos.security.cryptoFramework), you are advised to use the built-in system APIs.

Rule Configuration

// code-linter.json5
{
  "rules": {
    "@performance/crypto-replacement-check": "warn",
  }
}

Options

This rule is not configurable.

Example of Correct Code

import cryptoFramework from '@ohos.security.cryptoFramework';
// MD5 encryption
let md = cryptoFramework.createMd('MD5');

Example of Incorrect Code

import { CryptoJS } from '@ohos/crypto-js';

/**
 * Library installation: ohpm install @ohos/crypto-js
 */

// MD5 encryption
let mdOutput = CryptoJS.MD5('Message');

Rule Set

plugin:@performance/recommended
plugin:@performance/all

For details about how to configure Code Linter check rules, see Code Linter.