Base64 Converter
<Window x:Class="Base64Convertor.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="387" Width="629">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<GroupBox Grid.Row="0" Header="Input" HorizontalAlignment="Stretch" Margin="0,0,0,0" Name="groupBox1" VerticalAlignment="Stretch">
<TextBox Name="txtInput" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="Yellow" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" AcceptsReturn="True" />
</GroupBox>
<TabControl Grid.Row="1">
<TabItem Header="Encode" >
<StackPanel Grid.Row="1" Orientation="Horizontal">
<Button Name="btnEncodeInputText" Content="From Input Text" Height="25" Margin="5" Click="btnEncodeInputText_Click" />
<Button Name="btnEncodeInputFile" Content="From Input File" Height="25" Margin="5" Click="btnEncodeInputFile_Click" />
<Button Name="btnCopyToClipboard" Content="Copy to Clipboard" Height="25" Margin="5" Click="btnCopyToClipboard_Click" />
</StackPanel>
</TabItem>
<TabItem Header="Decode">
<StackPanel Grid.Row="1" Orientation="Horizontal">
<Button Name="btnDecodeToOutput" Content="Decode to Output" Margin="5" Height="25" Click="btnDecodeToOutput_Click" />
<Button Name="btnDecodeToFile" Content="Decode to File" Height="25" Margin="5" Click="btnDecodeToFile_Click" />
</StackPanel>
</TabItem>
</TabControl>
<GroupBox Grid.Row="2" Header="Output" HorizontalAlignment="Stretch" Margin="0,0,0,0" Name="groupBox2" VerticalAlignment="Stretch">
<TextBox Name="txtOutput" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="Yellow" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" AcceptsReturn="True" />
</GroupBox>
</Grid>
</Window>
public
partial
class
MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private
void btnEncodeInputText_Click(object sender, RoutedEventArgs e)
{
txtOutput.Text = Convert.ToBase64String(Encoding.UTF8.GetBytes(txtInput.Text.Trim()));
}
private
void btnDecodeToOutput_Click(object sender, RoutedEventArgs e)
{
txtOutput.Text = Encoding.UTF8.GetString(Convert.FromBase64String(txtInput.Text.Trim()));
}
private
void btnEncodeInputFile_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog ofd = new
OpenFileDialog();
if (ofd.ShowDialog().Value == true)
{
var fileContent = File.ReadAllBytes(ofd.FileName);
txtOutput.Text = Convert.ToBase64String(fileContent);
MessageBox.Show("done!");
}
}
private
void btnCopyToClipboard_Click(object sender, RoutedEventArgs e)
{
Clipboard.SetText(txtOutput.Text);
}
private
void btnDecodeToFile_Click(object sender, RoutedEventArgs e)
{
SaveFileDialog sfd = new
SaveFileDialog();
if (sfd.ShowDialog().Value == true)
{
var fileContent = Convert.FromBase64String(txtInput.Text.Trim());
File.WriteAllBytes(sfd.FileName, fileContent);
MessageBox.Show("done!");
}
}
}
Base64 Converter的更多相关文章
- 加密代理和Retrofit解密Converter
最近在研究安卓的Retrofit框架,服务器的数据全部用加密算法加密了,发现无法使用"com.squareup.retrofit2:converter-gson:2.1.0"Jar ...
- Bugku一段base64
本文转自:本文为博主原创文章,如有转载请注明出处,谢谢. https://blog.csdn.net/pdsu161530247/article/details/74640746 链接中高手给出的解题 ...
- WPF converter(包含传递复杂参数)
单值转换器 将单一值转换为特定类型的值,以日期转换为例如下: 1.定制DateConverter类,其中当值从绑定源传播给绑定目标时,调用方法Convert. 1 public class DateC ...
- SSL Converter & Formats
https://www.sslshopper.com/ssl-converter.html PEM Format The PEM format is the most common format th ...
- coding++:js实现基于Base64的编码及解码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- URL安全的Base64编码
Base64编码可用于在HTTP环境下传递较长的标识信息.在其他应用程序中,也常常需要把二进制数据编码为适合放在URL(包括隐藏表单域)中的形式.此时,采用Base64编码不仅比较简短,同时也具有不可 ...
- Base64编码
Base64编码 写在前面 今天在做一个Android app时遇到了一个问题:Android端采用ASE对称加密的数据在JavaWeb(jre1.8.0_7)后台解密时,居然解密失败了!经过测试后发 ...
- Android数据加密之Base64编码算法
前言: 前面学习总结了平时开发中遇见的各种数据加密方式,最终都会对加密后的二进制数据进行Base64编码,起到一种二次加密的效果,其实呢Base64从严格意义上来说的话不是一种加密算法,而是一种编码算 ...
- java单向加密算法小结(1)--Base64算法
从这一篇起整理一下常见的加密算法以及在java中使用的demo,首先从最简单的开始. 简单了解 Base64严格来说并不是一种加密算法,而是一种编码/解码的实现方式. 我们都知道,数据在计算机网络之间 ...
随机推荐
- Codrops 优秀教程:实现效果精美的多层推拉菜单
Codrops 给我们分享了一个多层菜单的实现教程.他们试图探索创建一个嵌套的多级菜单,是非常有用的东西,可以有很多的内容,如网上商店的导航菜单. 这个 Push Menu 效果理论上可以包含无限嵌套 ...
- [SDK2.2]Windows Azure Virtual Network (1) 概念
<Windows Azure Platform 系列文章目录> Windows Azure Virtual Network是非常重要的概念,其主要作用有以下两点: 1.将多台Azure V ...
- path入门 20141102-1405
那Python有哪些缺点呢? 第一个缺点就是运行速度慢,和C程序相比非常慢, 第二个缺点就是代码不能加密. Python是解释型的 不是编译型的 Python解释器-CPython 命令行: 只需要在 ...
- 前端自动化开发之grunt
上篇文章介绍了前端模块化开发工具seaJs,利用seaJs我们可以轻松实现前端的模块化编程,参见http://www.cnblogs.com/luozhihao/p/4818782.html 那么今天 ...
- vue-resource 拦截器使用
在vue项目使用vue-resource的过程中,临时增加了一个需求,需要在任何一个页面任何一次http请求,增加对token过期的判断,如果token已过期,需要跳转至登录页面.如果要在每个页面中的 ...
- a[href^=""]的解释
a[href^="绝对路径"]这个算一种属性选择器,在这里是用来选择链接属性为“绝对路径”的a标签,其中的^其实是"以什么为开始"(begin with)的意思 ...
- Socket接收大数据的方法
byte[] buffer = new byte[BufferSize]; int bytesRead; // 读取的字节数 MemoryStream msStream = new MemoryStr ...
- silverlight制作虚线的边框
<Grid><Grid HorizontalAlignment="Center" VerticalAlignment="Center" x:N ...
- QTableWidget详解(样式、右键菜单、表头塌陷、多选等) 2013-10-23 10:54:04
一.设置表单样式 点击(此处)折叠或打开 table_widget->setColumnCount(4); //设置列数 table_widget->horizontalHeader()- ...
- Java递归列出所有文件和文件夹
package file_op; import java.io.File; public class file_list { static int n =0; /** * @param args */ ...