使用DESCryptoServiceProvider类对数据或者文件进行加密解密_dongjiecong1365的博客-程序员宅基地

技术标签: c#  ViewUI  ui  javascript  

None.gif using  System;
None.gif
using  System.Collections;
None.gif
using  System.ComponentModel;
None.gif
using  System.Data;
None.gif
using  System.Drawing;
None.gif
using  System.Web;
None.gif
using  System.Web.SessionState;
None.gif
using  System.Web.UI;
None.gif
using  System.Web.UI.WebControls;
None.gif
using  System.Web.UI.HtmlControls;
None.gif
using  System.Security.Cryptography;
None.gif
using  System.IO;
None.gif
using  System.Text;
None.gif
namespace  CommonFunction
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//// <summary>
InBlock.gif    
/// secret 的摘要说明。
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public partial class secrettest : System.Web.UI.Page
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
protected string txtFilePath,fileExtName;
InBlock.gif
InBlock.gif        Secret jiami 
= new Secret();
InBlock.gif
InBlock.gif        
protected void Page_Load(object sender, System.EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
// 在此处放置用户代码以初始化页面
ExpandedSubBlockEnd.gif
        }

ContractedSubBlock.gifExpandedSubBlockStart.gif        
Web Form Designer generated code#region Web Form Designer generated code
InBlock.gif        
override protected void OnInit(EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
//
InBlock.gif            
// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
InBlock.gif            
//
InBlock.gif
            InitializeComponent();
InBlock.gif            
base.OnInit(e);
ExpandedSubBlockEnd.gif        }

InBlock.gif        
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
InBlock.gif        
/// 此方法的内容。
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        private void InitializeComponent()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{    
InBlock.gif
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
InBlock.gif        
protected void btnJia_Click(object sender, System.EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            txtNew.Text 
= jiami.DesEncrypt(txtValue.Text,"songxiud");
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
protected void btnJie_Click(object sender, System.EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            txtValue.Text 
= jiami.DesDecrypt(txtNew.Text.Trim(),"songxiud");
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
protected void btnOpen_Click(object sender, System.EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
if(filePath.PostedFile.FileName != "")
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                txtFilePath 
=filePath.PostedFile.FileName;
InBlock.gif                fileExtName 
= txtFilePath.Substring(txtFilePath.LastIndexOf(".")+1,3);
InBlock.gif
InBlock.gif                
if(fileExtName !="txt" && fileExtName != "TXT")
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    Response.Write(
"请选择文本文件");
ExpandedSubBlockEnd.gif                }

InBlock.gif                
else
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    StreamReader fileStream 
= new StreamReader(txtFilePath,Encoding.Default);
InBlock.gif                    txtContent.Text 
= fileStream.ReadToEnd();
InBlock.gif                    fileStream.Close();
ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
protected void btnFile_Click(object sender, System.EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            jiami.DesEncrypt(Server.MapPath(
"txtFile")+"\\work.txt",Server.MapPath("txtFile")+"\\work1.txt","songxiud");
InBlock.gif            StreamReader fileStream 
= new StreamReader(Server.MapPath("txtFile")+"\\work1.txt",Encoding.Default);
InBlock.gif            txtContent.Text 
= fileStream.ReadToEnd();
InBlock.gif            fileStream.Close();
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
protected void btnFileDes_Click(object sender, System.EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            jiami.DesDecrypt(Server.MapPath(
"txtFile")+"\\work1.txt",Server.MapPath("txtFile")+"\\workjie.txt","songxiud");
InBlock.gif            StreamReader fileStream 
= new StreamReader(Server.MapPath("txtFile")+"\\workjie.txt",Encoding.Default);
InBlock.gif            txtContent.Text 
= fileStream.ReadToEnd();
InBlock.gif            fileStream.Close();
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif    
ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif
ExpandedBlockStart.gif ContractedBlock.gif <% dot.gif @ Page language="c#" Inherits="CommonFunction.secrettest" CodeFile="secret.aspx.cs"  %>
None.gif
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"  >
None.gif
< HTML >
None.gif    
< HEAD >
None.gif        
< title > secret </ title >
None.gif        
< meta  content ="Microsoft Visual Studio 7.0"  name ="GENERATOR" >
None.gif        
< meta  content ="C#"  name ="CODE_LANGUAGE" >
None.gif        
< meta  content ="JavaScript"  name ="vs_defaultClientScript" >
None.gif        
< meta  content ="http://schemas.microsoft.com/intellisense/ie5"  name ="vs_targetSchema" >
None.gif    
</ HEAD >
None.gif    
< body  bgColor ="#ccccff" >
None.gif        
< form  id ="usersecret"  method ="post"  encType ="multipart/form-data"  runat ="server" >
None.gif            
< FONT  face ="宋体" >
None.gif                
< asp:textbox  id ="txtValue"  style ="Z-INDEX: 101; LEFT: 168px; POSITION: absolute; TOP: 72px"  runat ="server" ></ asp:textbox >< asp:button  id ="btnJia"  style ="Z-INDEX: 102; LEFT: 344px; POSITION: absolute; TOP: 72px"  runat ="server"
None.gif                    Text
="数据加密"  onclick ="btnJia_Click" ></ asp:button >< asp:button  id ="btnJie"  style ="Z-INDEX: 103; LEFT: 344px; POSITION: absolute; TOP: 104px"  runat ="server"
None.gif                    Text
="数据解密"  onclick ="btnJie_Click" ></ asp:button >< asp:textbox  id ="txtNew"  style ="Z-INDEX: 104; LEFT: 168px; POSITION: absolute; TOP: 112px"  runat ="server" ></ asp:textbox >< asp:textbox  id ="txtContent"  style ="Z-INDEX: 105; LEFT: 168px; POSITION: absolute; TOP: 160px"
None.gif                    runat
="server"  Width ="200px"  Height ="296px"  TextMode ="MultiLine" ></ asp:textbox >< asp:button  id ="btnFile"  style ="Z-INDEX: 106; LEFT: 408px; POSITION: absolute; TOP: 312px"  runat ="server"
None.gif                    Text
="文件加密"  onclick ="btnFile_Click" ></ asp:button >< asp:button  id ="btnFileDes"  style ="Z-INDEX: 107; LEFT: 408px; POSITION: absolute; TOP: 384px"
None.gif                    runat
="server"  Text ="文件解密"  onclick ="btnFileDes_Click" ></ asp:button >< INPUT  id ="filePath"  style ="Z-INDEX: 108; LEFT: 408px; POSITION: absolute; TOP: 160px"
None.gif                    type
="file"  name ="File1"  runat ="server" >
None.gif                
< asp:button  id ="btnOpen"  style ="Z-INDEX: 109; LEFT: 408px; POSITION: absolute; TOP: 240px"  runat ="server"
None.gif                    Text
="打开文件"  onclick ="btnOpen_Click" ></ asp:button >
None.gif                
< asp:Label  id ="Label1"  style ="Z-INDEX: 110; LEFT: 168px; POSITION: absolute; TOP: 32px"  runat ="server" > 该示例以txtFile文件夹下的Work.txt文件为例 </ asp:Label ></ FONT ></ form >
None.gif    
</ body >
None.gif
</ HTML >
None.gif
None.gif using  System;
None.gif
using  System.Security.Cryptography;
None.gif
using  System.IO;
None.gif
using  System.Text;
None.gif
namespace  CommonFunction
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//// <summary>
InBlock.gif    
///数据加密、解密,文件的加密解密
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public class Secret
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
public Secret()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
//
InBlock.gif            
// TODO: 在此处添加构造函数逻辑
InBlock.gif            
//
ExpandedSubBlockEnd.gif
        }

InBlock.gif
InBlock.gif        
public string DesEncrypt(string strText, string strEncrKey)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
byte[] byKey=null;
ExpandedSubBlockStart.gifContractedSubBlock.gif            
byte[] IV= dot.gif{ 0x120x340x560x780x900xAB0xCD0xEF};
InBlock.gif            
try
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                byKey 
= System.Text.Encoding.UTF8.GetBytes(strEncrKey.Substring(0,strEncrKey.Length));
InBlock.gif                DESCryptoServiceProvider des 
= new DESCryptoServiceProvider();
InBlock.gif                
byte[] inputByteArray = Encoding.UTF8.GetBytes(strText);
InBlock.gif                MemoryStream ms 
= new MemoryStream();
InBlock.gif                CryptoStream cs 
= new CryptoStream(ms, des.CreateEncryptor(byKey, IV), CryptoStreamMode.Write) ;
InBlock.gif                cs.Write(inputByteArray, 
0, inputByteArray.Length);
InBlock.gif                cs.FlushFinalBlock();
InBlock.gif                
return Convert.ToBase64String(ms.ToArray());
InBlock.gif
InBlock.gif
ExpandedSubBlockEnd.gif            }

InBlock.gif            
catch(System.Exception error)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return "error:" +error.Message+"\r";
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
public string DesDecrypt(string strText,string sDecrKey)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
byte[] byKey = null;
ExpandedSubBlockStart.gifContractedSubBlock.gif            
byte[] IV= dot.gif{ 0x120x340x560x780x900xAB0xCD0xEF};
InBlock.gif            
byte[] inputByteArray = new Byte[strText.Length];
InBlock.gif            
try
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                byKey 
= System.Text.Encoding.UTF8.GetBytes(sDecrKey.Substring(0,8));
InBlock.gif                DESCryptoServiceProvider des 
= new DESCryptoServiceProvider();
InBlock.gif                inputByteArray 
= Convert.FromBase64String(strText);            
InBlock.gif                MemoryStream ms 
= new MemoryStream();
InBlock.gif                CryptoStream cs 
= new CryptoStream(ms, des.CreateDecryptor(byKey, IV), CryptoStreamMode.Write); 
InBlock.gif                cs.Write(inputByteArray, 
0, inputByteArray.Length); 
InBlock.gif                cs.FlushFinalBlock();
InBlock.gif                System.Text.Encoding encoding 
= new System.Text.UTF8Encoding();
InBlock.gif                
return encoding.GetString(ms.ToArray());
ExpandedSubBlockEnd.gif            }

InBlock.gif            
catch(System.Exception error)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return "error:"+error.Message+"\r";
ExpandedSubBlockEnd.gif            }

InBlock.gif
ExpandedSubBlockEnd.gif        }

InBlock.gif        
InBlock.gif        
public void DesEncrypt(string m_InFilePath,string m_OutFilePath,string strEncrKey)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
byte[] byKey=null;
ExpandedSubBlockStart.gifContractedSubBlock.gif            
byte[] IV= dot.gif{ 0x120x340x560x780x900xAB0xCD0xEF};
InBlock.gif            
try
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                byKey 
= System.Text.Encoding.UTF8.GetBytes(strEncrKey.Substring(0,8));
InBlock.gif                FileStream fin 
= new FileStream(m_InFilePath, FileMode.Open, FileAccess.Read);
InBlock.gif                FileStream fout 
= new FileStream(m_OutFilePath, FileMode.OpenOrCreate, FileAccess.Write);
InBlock.gif                fout.SetLength(
0);
InBlock.gif                
byte[] bin = new byte[100]; 
InBlock.gif                
long rdlen = 0;
InBlock.gif                
long totlen = fin.Length;
InBlock.gif                
int len; 
InBlock.gif                DES des 
= new DESCryptoServiceProvider();
InBlock.gif                CryptoStream encStream 
= new CryptoStream(fout, des.CreateEncryptor(byKey, IV), CryptoStreamMode.Write);
InBlock.gif                
while(rdlen < totlen)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    len 
= fin.Read(bin, 0100);
InBlock.gif                    encStream.Write(bin, 
0, len);
InBlock.gif                    rdlen 
= rdlen + len;
ExpandedSubBlockEnd.gif                }

InBlock.gif
InBlock.gif                encStream.Close();
InBlock.gif                fout.Close();
InBlock.gif                fin.Close();
ExpandedSubBlockEnd.gif            }

InBlock.gif            
catch
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
public void DesDecrypt(string m_InFilePath,string m_OutFilePath,string sDecrKey)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
byte[] byKey = null;
ExpandedSubBlockStart.gifContractedSubBlock.gif            
byte[] IV= dot.gif{ 0x120x340x560x780x900xAB0xCD0xEF};
InBlock.gif            
try
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                byKey 
= System.Text.Encoding.UTF8.GetBytes(sDecrKey.Substring(0,8));
InBlock.gif                FileStream fin 
= new FileStream(m_InFilePath, FileMode.Open, FileAccess.Read);
InBlock.gif                FileStream fout 
= new FileStream(m_OutFilePath, FileMode.OpenOrCreate, FileAccess.Write);
InBlock.gif                fout.SetLength(
0);
InBlock.gif                
InBlock.gif                
byte[] bin = new byte[100]; 
InBlock.gif                
long rdlen = 0
InBlock.gif                
long totlen = fin.Length; 
InBlock.gif                
int len; 
InBlock.gif
InBlock.gif                DES des 
= new DESCryptoServiceProvider();
InBlock.gif                CryptoStream encStream 
= new CryptoStream(fout, des.CreateDecryptor(byKey, IV), CryptoStreamMode.Write);
InBlock.gif
InBlock.gif                
while(rdlen < totlen)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    len 
= fin.Read(bin, 0100);
InBlock.gif                    encStream.Write(bin, 
0, len);
InBlock.gif                    rdlen 
= rdlen + len;
ExpandedSubBlockEnd.gif                }

InBlock.gif
InBlock.gif                encStream.Close();
InBlock.gif                fout.Close();
InBlock.gif                fin.Close();
InBlock.gif
ExpandedSubBlockEnd.gif            }

InBlock.gif            
catch
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
ExpandedSubBlockEnd.gif            }

InBlock.gif
InBlock.gif
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
public string MD5Encrypt(string strText)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            MD5 md5 
= new MD5CryptoServiceProvider();
InBlock.gif            
byte[] result = md5.ComputeHash(System.Text.Encoding.Default.GetBytes(strText));
InBlock.gif            
return System.Text.Encoding.Default.GetString(result);
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
public string MD5Decrypt(string strText)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            MD5 md5 
= new MD5CryptoServiceProvider();
InBlock.gif            
byte[] result = md5.TransformFinalBlock(System.Text.Encoding.Default.GetBytes(strText),0,strText.Length);
InBlock.gif            
return System.Text.Encoding.Default.GetString(result);
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif

转载于:https://www.cnblogs.com/caviare/archive/2006/12/28/606252.html

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/dongjiecong1365/article/details/101644709

智能推荐

redis 基本命令__萤火的博客-程序员宅基地_redis 队列命令

基本命令# 客户端连接服务器redis-cli -h &lt;address&gt; -p &lt;port&gt; -a &lt;password&gt;# 列出服务器信息INFO# 查看服务是否允许PINGkey# 判断键的存在; 返回存在的键的数量EXISTS &lt;key1&gt; &lt;key2&gt;# 删除键DEL &lt;key1&gt; &lt;ke............

ppt怎么转换成pdf_baidu_16815395的博客-程序员宅基地

ppt怎么转换成pdf 相信没有哪一位愿意把平时的工作放到周末来完成的,处理眼下的一大堆ppt文件,若将ppt转为pdf,有什么好的方法,不用手动复制,借助专业的ppt转换成pdf转换器就能帮你如愿转换。下面我们来学习它的一些操作技巧。  如何将ppt、Word文件转换成pdf格式文件?  1、以迅捷ppt转pdf转换器为例,该软件比较适用任何复杂内容的PDF文档,无需安装Adobe A...

好玩的WPF第二弹:电子表字体显示时间+多彩呼吸灯特效button_weixin_30793643的博客-程序员宅基地

我们先来看看Quartz MS字体动态显示系统时间的效果,难度相较于上一篇也要简单很多。首先是定义一个TextBlock例如以下。&lt;Grid&gt; &lt;TextBlock Name="tBlockTime" HorizontalAlignment="Center" VerticalAlignment="Center" F...

javascript数组常用api 方法_沉迷...的博客-程序员宅基地

本文总结了javascript常用的数组的方法包括 forEach filter map join concat sort splice indexOf reverse find every push unshift pop shift等

Pod资源对象+健康检查_MAYSYQ的博客-程序员宅基地

Deployment、Service、Pod是k8s最核心的3个资源对象Deployment:最常见的无状态的控制器,支持应用的扩容缩容、滚动更新等操作Service:为弹性变动且存在生命周期的Pod对象提供了一个固定的访问接口,用户服务发现和服务访问Pod:是运行容器以及调度的最小单位,同一个Pod可以同时运行多个容器,这些容器共享NET、UTS、IPC,除此之...

Hadoop集群及Linux操作脚本_wen-pan的博客-程序员宅基地

以下是记录一些操作Linux及hadoop集群等的一些群体操作脚本,比如有启动 / 关闭hadoop集群脚本,启动 / 关闭zookeeper集群脚本,查看每台服务器上的java进程脚本,集群分发脚本等。将脚本编写完毕后需要配置到环境变量中,才可以在任何目录下进行使用!操作详细讲解:1.集群配置分发脚本:2) rsyncrsync远程同步工具,主要用于备份和镜像。具有速度快、...

随便推点

kali安装配置问题_qiuqiurangwoguo的博客-程序员宅基地

1,安装kali系统后输入账号密码登录后显示黑屏关于vm虚拟机上安装kali之后登录黑屏的问题_枫裳的博客-程序员宅基地2,虚拟机kali安装Vmware toolskali linux安装vmware tools过程详解_robacco的博客-程序员宅基地_kali安装vmware tools步骤3,配置apt源配置Kali的apt命令在线安装包的源为国内源_小乙!的博客-程序员宅基地(1)问题1:更新源提示签名无效kali 解决签名失效问题 - 誉津 - 博客园...

saltstack之master配置文件_weixin_33817333的博客-程序员宅基地

salt配置文件master:1.主要配置信息#可以将主配置文件拆分不同文件放置到此目录中default_include:master.d/*.conf#绑定地址interface:0.0.0.0#设置ipv6地址监听ipv6:False#消息发布使用端口TCPpublish_port:4505#运行master的用户user:root#最大文件...

【整理】I/O复用模型中的 select、poll、epoll_sinat_31135199的博客-程序员宅基地

1. select、poll、epoll简介  epoll跟select都能提供多路I/O复用的解决方案。在现在的Linux内核里有都能够支持,其中epoll是Linux所特有,而select则应该是POSIX所规定,一般操作系统均有实现select:  select本质上是通过设置或者检查存放fd标志位的数据结构来进行下一步处理。这样所带来的缺点是:1、 单个进程可监视的

Java开发必学!mysql升级-5.1升级到5.7_普通网友的博客-程序员宅基地

前言本份文档内容涵盖: Java、MyBatis、ZooKeeper、Dubbo、Elasticsearch、Memcached、Redis、MySQL、 Spring、Spring Boot、Spring Cloud、RabbitMQ、Kafka、Linux等技术栈,共1000多道面试题。由于文档内容过多,所以只列举了以下目录部分,每个知识点都有更细化的内容!蚂蚁金服(五面)蚂蚁金服:一面一面就做了一道算法题,要求两小时内完成,给了长度为N的有重复元素的数组,要求输出第10大的数。典型的

Datawhale 零基础入门NLP赛事-Task 1 赛题理解_weixin_49520857的博客-程序员宅基地

**Datawhale 零基础入门NLP赛事-Task 1 赛题理解这个赛题是一个字符识别问题,要求选手对新闻文本进行分类。赛题数据已经被匿名化处理,训练集中有20w条样本,测试集A包括5w条样本,测试集B包括5w条样本。数据集中标签的对应关系为{‘科技’: 0, ‘股票’: 1, ‘体育’: 2, ‘娱乐’: 3, ‘时政’: 4, ‘社会’: 5, ‘教育’: 6, ‘财经’: 7, ‘家居’: 8, ‘游戏’: 9, ‘房产’: 10, ‘时尚’: 11, ‘彩票’: 12, ‘星座’: 13}

postgresql数据库备份和恢复_weixin_33872566的博客-程序员宅基地

PostgreSQL自带一个客户端pgAdmin,里面有个备份,恢复选项,也能对数据库进行备份 恢复(还原),但最近发现数据库慢慢庞大的时候,经常出错,备份的文件过程中出错的几率那是相当大,手动调节灰常有限。所以一直寻找完美的备份恢复方案。 梦里寻他千百度,伊人却在灯火阑珊处...其实PostgreSQL内置不少的工具,寻找的备份恢复方案就在其中:pg_dump,psql。这两个指令 在数...

推荐文章

热门文章

相关标签