天天看点

db2 encrypt加密后数据长度

db2 encrypt加密后数据长度

按照IBM原文所说

加密后的数据由三部分组成

(--data-string-expression--+--------------------------------------------------------------+--)
                           '-,--password-string-expression--+---------------------------+-'   
                                                            '-,--hint-string-expression-'
           

The result data type of the function is VARCHAR FOR BIT DATA.

  • When the optional hint parameter is specified, the length attribute of the result is equal to the length attribute of the unencrypted data + 8 bytes + the number of bytes until the next 8-byte boundary + 32 bytes for the length of the hint.

    当指定了可选的提示参数时,结果的长度属性等于未加密数据的长度属性+ 8字节+直到下一个8字节边界的字节数+对于提示长度的32字节。

  • When the optional hint parameter is not specified, the length

    attribute of the result is equal to the length attribute of the

    unencrypted data + 8 bytes + the number of bytes until the next 8-byte boundary.

    如果未指定可选的提示参数,则结果的长度属性等于未加密数据的长度属性+ 8字节+直到下一个8字节边界的字节数。

加密后数据以8字节为单位

未指定提示参数时,加密后数据长度计算公式为

8*((x+8)/8+1) 即 8*(x/8+2)(除以8结果保留商的整数)

指定了可选的提示参数时再加32即可

继续阅读