dnf mysql数据库密码_数据库密码加密公用秘要生成器,数据库密码加密解密入口...

public classEncryptor {public static final String HUNDSUN_VERSION="@system 管理平台 @version 2.0.1 @lastModiDate @describe ";protected static final int BLOCK_SIZE = 8;private int[] workingKey = null;private byte[] userkey = null;/*** standard constructor.*/

public Encryptor(byte[] userkey) {this.userkey =userkey;

}/*** initialise a DES cipher.

*

*@paramforEncryption whether or not we are for encryption.

*@paramparams the parameters required to set up the cipher.

*@exceptionIllegalArgumentException if the params argument is

* inappropriate.*/

public void init(boolean encrypting, byte[] key) {if (key != null) {

workingKey=generateWorkingKey(encrypting, key);return;

}else{throw newIllegalArgumentException("invalid parameter passed to DES init - ");

}

}public intgetBlockSize() {returnBLOCK_SIZE;

}/***

it used to check the parameters and then call desfun()

*/

public intprocessBlock(byte[] in,intinOff,byte[] out,intoutOff) {if (workingKey == null) {throw new IllegalStateException("DES engine not initialised");

}if ( (inOff + BLOCK_SIZE) >in.length) {throw new IllegalStateException("input buffer too short");

}if ( (outOff + BLOCK_SIZE) >out.length) {throw new IllegalStateException("output buffer too short");

}

desFunc(workingKey, in, inOff, out, outOff);returnBLOCK_SIZE;

}/*** what follows is mainly taken from "Applied Cryptography", by

* Bruce Schneier, however it also bears great resemblance to Richard

* Outerbridge's D3DES...*/

static short[] Df_Key ={0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,0x89, 0xab, 0xcd, 0xef, 0x01, 0x23, 0x45, 0x67};static short[] bytebit ={0200, 0100, 040, 020, 010, 04, 02, 01};static int[] bigbyte ={0x800000, 0x400000, 0x200000, 0x100000,0x80000, 0x40000, 0x20000, 0x10000,0x8000, 0x4000, 0x2000, 0x1000,0x800, 0x400, 0x200, 0x100,0x80, 0x40, 0x20, 0x10,0x8, 0x4, 0x2, 0x1};/** Use the key schedule specified in the Standard (ANSI X3.92-1981).*/

static byte[] pc1 ={56, 48, 40, 32, 24, 16, 8, 0, 57, 49, 41, 33, 25, 17,9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35,62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21,13, 5, 60, 52, 44, 36, 28, 20, 12, 4, 27, 19, 11, 3};static byte[] totrot ={1, 2, 4, 6, 8, 10, 12, 14,15, 17, 19, 21, 23, 25, 27, 28};static byte[] pc2 ={13, 16, 10, 23, 0, 4, 2, 27, 14, 5, 20, 9,22, 18, 11, 3, 25, 7, 15, 6, 26, 19, 12, 1,40, 51, 30, 36, 46, 54, 29, 39, 50, 44, 32, 47,43, 48, 38, 55, 33, 52, 45, 41, 49, 35, 28, 31};static int[] SP1 ={0x01010400, 0x00000000, 0x00010000, 0x01010404,0x01010004, 0x00010404, 0x00000004, 0x00010000,0x00000400, 0x01010400, 0x01010404, 0x00000400,0x01000404, 0x01010004, 0x01000000, 0x00000004,0x00000404, 0x01000400, 0x01000400, 0x00010400,0x00010400, 0x01010000, 0x01010000, 0x01000404,0x00010004, 0x01000004, 0x01000004, 0x00010004,0x00000000, 0x00000404, 0x00010404, 0x01000000,0x00010000, 0x01010404, 0x00000004, 0x01010000,0x01010400, 0x01000000, 0x01000000, 0x00000400,0x01010004, 0x00010000, 0x00010400, 0x01000004,0x00000400, 0x00000004, 0x01000404, 0x00010404,0x01010404, 0x00010004, 0x01010000, 0x01000404,0x01000004, 0x00000404, 0x00010404, 0x01010400,0x00000404, 0x0100040

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
CentOS 9 目前还没有正式发布,最新版本为 CentOS 8,以下是在 CentOS 8 上安装数据库的步骤: 1. 安装数据库管理系统 CentOS 8 默认提供了 MariaDB 数据库管理系统,可以使用以下命令安装: ``` sudo dnf install mariadb-server ``` 如果需要安装其他的数据库管理系统,可以自行搜索相关安装教程。 2. 启动数据库服务 安装完成后,通过以下命令启动数据库服务: ``` sudo systemctl start mariadb ``` 也可以设置开机自启动: ``` sudo systemctl enable mariadb ``` 3. 配置数据库 安装完成后,需要进行一些配置。使用以下命令进入数据库: ``` sudo mysql -u root ``` 默认情况下,MariaDB 的 root 用户没有密码,直接按回车键即可登录。 接下来,可以执行以下命令来设置 root 用户密码: ``` ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password'; ``` 其中,new_password 是你要设置的密码。 4. 创建数据库和用户 登录数据库后,可以执行以下命令来创建数据库: ``` CREATE DATABASE mydatabase; ``` 其中,mydatabase 是你要创建的数据库名称。 接下来,可以创建一个新用户并授权其访问该数据库: ``` CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'user_password'; GRANT ALL PRIVILEGES ON mydatabase.* TO 'myuser'@'localhost'; ``` 其中,myuser 是你要创建的用户名,user_password 是该用户的密码,mydatabase 是你要授权访问的数据库名称。 5. 退出数据库 完成以上步骤后,使用以下命令退出数据库: ``` quit; ``` 至此,CentOS 8 上的数据库安装和配置就完成了。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值