Skip to content

Commit

Permalink
add doc of md5(),sha()/sha1() and remove descode(),encode() (#1064)
Browse files Browse the repository at this point in the history
  • Loading branch information
yangj1211 authored May 13, 2024
1 parent ed7f317 commit eb0034d
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 103 deletions.
37 changes: 37 additions & 0 deletions docs/MatrixOne/Reference/Functions-and-Operators/String/md5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# MD5()

## 函数说明

`MD5()` 函数一种广泛使用的哈希函数,用于生成一个字符串的 32 字符长的十六进制 MD5 哈希值,它可以将任意长度的输入消息转换为一个 128 位(16 字节)的哈希值,通常表示为 32 位的十六进制字符串。如果参数为 NULL,则返回 NULL。

## 函数语法

```
> MD5(str)
```

## 参数释义

| 参数 | 说明 |
| -------- | ------------------------------------ |
| str | 必要参数。要转换的字符串 |

## 示例

```SQL
mysql> select md5("hello world");
+----------------------------------+
| md5(hello world) |
+----------------------------------+
| 5eb63bbbe01eeed093cb22bb8f5acdc3 |
+----------------------------------+
1 row in set (0.00 sec)

mysql> select md5(null);
+-----------+
| md5(null) |
+-----------+
| NULL |
+-----------+
1 row in set (0.00 sec)
```
45 changes: 45 additions & 0 deletions docs/MatrixOne/Reference/Functions-and-Operators/String/sha1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# SHA1()/SHA()

## 函数说明

`SHA1()/SHA()` 函数是一种加密哈希函数,用于计算并返回给定字符串的 SHA-1 哈希值,它将任意长度的输入消息转换为一个固定长度(160 位,即 20 字节)的哈希值,通常表示为 40 个十六进制字符。如果参数为 NULL,则返回 NULL。

## 函数语法

```
> SHA1/SHA(str)
```

## 参数释义

| 参数 | 说明 |
| -------- | ------------------------------------ |
| str | 必要参数。要加密的字符串 |

## 示例

```SQL
mysql> select sha1("hello world");
+------------------------------------------+
| sha1(hello world) |
+------------------------------------------+
| 2aae6c35c94fcfb415dbe95f408b9ce91ee846ed |
+------------------------------------------+
1 row in set (0.00 sec)

mysql> select sha("hello world");
+------------------------------------------+
| sha(hello world) |
+------------------------------------------+
| 2aae6c35c94fcfb415dbe95f408b9ce91ee846ed |
+------------------------------------------+
1 row in set (0.00 sec)

mysql> select sha1(null);
+------------+
| sha1(null) |
+------------+
| NULL |
+------------+
1 row in set (0.00 sec)
```
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,13 @@
| [LOWER()](./String/lower.md) | 用于将给定的字符串转换为小写形式。|
| [LPAD()](./String/lpad.md) | 用于在字符串左侧填充。|
| [LTRIM()](./String/ltrim.md) | 将输入字符串的前部空格去除,返回处理后的字符。|
| [MD5()](./String/md5.md) | 将输入字符串生成一个 32 字符长的十六进制 MD5 哈希值。|
| [OCT()](./String/oct.md) | 返回参数的八进制值的字符串|
| [REPEAT()](./String/repeat.md) | 用于将输入的字符串重复 n 次,并返回一个新的字符串|
| [REVERSE()](./String/reverse.md) | 将 str 字符串中的字符顺序翻转输出。|
| [RPAD()](./String/rpad.md) | 用于在字符串右侧填充|
| [RTRIM()](./String/rtrim.md) | 将输入字符串的后方空格去除|
| [SHA1()/SHA()](./String/sha1.md) | 用于计算并返回给定字符串的 SHA-1 哈希值。|
| [SHA2()](./String/sha2.md) | 返回输入字符串的 SHA2 哈希值。|
| [SPACE()](./String/space.md) | 返回 N 个空格组成的字符串。|
| [SPLIT_PART()](./String/split_part.md) | 用于在给定的分隔符基础上将一个字符串分解成多个部分|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,5 @@
| [BINARY()](binary.md) | 将值转换为二进制字符串的函数 |
| [CAST()](cast.md) | 将值转换为特定类型,用于小数转数值和字符型 |
| [CONVERT()](convert.md) | 将值转换为特定类型,用于日期和时间值、小数之间进行转换 |
| [DECODE()](decode.md) | 将二进制数据解码为文本表示 |
| [ENCODE()](encode.md) | 将二进制数据编码为文本表示 |
| [SERIAL()](serial.md) | 将连接串序列化,不处理 NULL 值 |
| [SERIAL_FULL()](serial_full.md) | 将连接串序列化,处理 NULL 值 |

This file was deleted.

This file was deleted.

4 changes: 2 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,6 @@ nav:
- BINARY: MatrixOne/Reference/Operators/operators/cast-functions-and-operators/binary.md
- CAST: MatrixOne/Reference/Operators/operators/cast-functions-and-operators/cast.md
- CONVERT: MatrixOne/Reference/Operators/operators/cast-functions-and-operators/convert.md
- DECODE: MatrixOne/Reference/Operators/operators/cast-functions-and-operators/decode.md
- ENCODE: MatrixOne/Reference/Operators/operators/cast-functions-and-operators/encode.md
- SERIAL: MatrixOne/Reference/Operators/operators/cast-functions-and-operators/serial.md
- SERIAL_FULL: MatrixOne/Reference/Operators/operators/cast-functions-and-operators/serial_full.md
- 比较函数和运算符:
Expand Down Expand Up @@ -557,11 +555,13 @@ nav:
- LOWER(): MatrixOne/Reference/Functions-and-Operators/String/lower.md
- LPAD(): MatrixOne/Reference/Functions-and-Operators/String/lpad.md
- LTRIM(): MatrixOne/Reference/Functions-and-Operators/String/ltrim.md
- MD5(): MatrixOne/Reference/Functions-and-Operators/String/md5.md
- OCT(): MatrixOne/Reference/Functions-and-Operators/String/oct.md
- REPEAT(): MatrixOne/Reference/Functions-and-Operators/String/repeat.md
- REVERSE(): MatrixOne/Reference/Functions-and-Operators/String/reverse.md
- RPAD(): MatrixOne/Reference/Functions-and-Operators/String/rpad.md
- RTRIM(): MatrixOne/Reference/Functions-and-Operators/String/rtrim.md
- SHA1()/SHA(): MatrixOne/Reference/Functions-and-Operators/String/sha1.md
- SHA2(): MatrixOne/Reference/Functions-and-Operators/String/sha2.md
- SPACE(): MatrixOne/Reference/Functions-and-Operators/String/space.md
- SPLIT_PART(): MatrixOne/Reference/Functions-and-Operators/String/split_part.md
Expand Down

0 comments on commit eb0034d

Please sign in to comment.