base64

How to Base64 encode extended character sets properly using SQL/T-SQL

∥☆過路亽.° 提交于 2019-12-24 20:10:41
问题 I am having trouble getting the following values to base64 encode in a fashion that decodes. I have systems (.NET and C++/Objective C) that base64 encode into the following values. e.g.: 2LPZhNin2YUg2KzbjNix2KfZhg== <-- سلام جیران В России Base64 кодирует вас --> 0JIg0KDQvtGB0YHQuNC4IEJhc2U2NCDQutC+0LTQuNGA0YPQtdGCINCy0LDRgQ== ❤️💥🤪🦌🎅⛄🎄🤐🙈🙉🙊💩 --> 4p2k77iP8J+SpfCfpKrwn6aM8J+OheKbhPCfjoTwn6SQ8J+ZiPCfmYnwn5mK8J+SqQ== I found one function posted on stack overflow that could decode these properly

Requesting URLs with base64 data encoded

落花浮王杯 提交于 2019-12-24 19:18:53
问题 I'm trying to request a URL with data encoded in base64 on it, like so: http://www.somepage.com/es_e/bla_bla#eyJkYXRhIjp7ImNvdW50cnlJZCI6IkVTIiwicmVnaW9uSWQiOiI5MjAiLCJkdXJhdGlvbiI6NywibWluUGVyc29ucyI6MX0sImNvbmZpZyI6eyJwYWdlIjoiMCJ9fQ== What I do, is build a JSON object, encode it into base64, and append it to a url like this: new_data = {"data": {"countryId": "ES", "regionId": "920", "duration": 7, "minPersons": 1}, "config": {"page": 2}} json_data = json.dumps(new_data) new_url = "http:/

Unable to make Guava base64 encode/decode work

半腔热情 提交于 2019-12-24 16:14:03
问题 It seems there is a very silly mistake somewhere as the following hello-world program is not working for me. import com.google.common.io.BaseEncoding; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; String hello = "hello"; junit.framework.Assert.assertEquals( hello.getBytes(), BaseEncoding.base64().decode( BaseEncoding.base64().encode(hello.getBytes()) ) ); I even tried hello.getBytes("ISO-8859-1") What am I missing? 回答1: Arrays (confusingly) do

FileReader.readAsDataURL result returning format exception when entered in Convert.FromBase64String

三世轮回 提交于 2019-12-24 14:55:05
问题 I'm using the following to convert an image to a base64 encoded string. On the client website in javascript: var reader = new FileReader(); reader.onloadend = function () { data64 = reader.result; }; reader.readAsDataURL(myFile); Now I pass this data to the server, which does the following: var data = Convert.FromBase64String(data64); However this results in a format exception: The format of s is invalid. s contains a non-base-64 character, more than two padding characters, or a non-white

Exception using DatatypeConverter.parseBase64Binary

戏子无情 提交于 2019-12-24 14:40:24
问题 Am sending a json string of png data which i want to save the image to disk. jsonInputString= URLDecoder.decode( inputString, "UTF-8" ); jsonInputString= jsonInputString.substring(inputStrjsonInputStringing.indexOf(",")+1); byte[] decodedBytes = DatatypeConverter.parseBase64Binary(jsonInputString); jsonInputString after it gets sanitised: iVBORw0KGgoAAAANSUhEUgAAAlgAAABkCAYAAABaQU4jAAAOUUlEQVR4Xu3dgZUMywIG4BEBIkAEiAARWBEggiUCRIAIEAEiQARsBIgAEXjv7/NqX5kzs9szXd3Ts/P1OXtcV3d191fl9n+rqqsv

S实现图片压缩、预览、图片Base64转换

你。 提交于 2019-12-24 14:40:05
//封装一个函数 function ImgToBase64(file, maxLen, callBack) { var img = new Image(); var reader = new FileReader();//读取客户端上的文件 reader.onload = function () { var url = reader.result;//读取到的文件内容.这个属性只在读取操作完成之后才有效,并且数据的格式取决于读取操作是由哪个方法发起的.所以必须使用reader.onload, img.src = url;//reader读取的文件内容是base64,利用这个url就能实现上传前预览图片 }; img.onload = function () { //生成比例 var width = img.width, height = img.height; //计算缩放比例 var rate = 1; if (width >= height) { if (width > maxLen) { rate = maxLen / width; } } else { if (height > maxLen) { rate = maxLen / height; } }; img.width = width * rate; img.height = height * rate; /

What's the best candidate padding char for url-safe and filename-safe base64?

丶灬走出姿态 提交于 2019-12-24 11:03:05
问题 The padding char for the official base64 is '=', which might need to be percent-encoded when used in a URL. I'm trying to find the best padding char so that my encoded string can be both url safe (I'll be using the encoded string as parameter value, such as id=encodedString) AND filename safe (I'll be using the encoded string directly as filename). Dot ('.') is a popular candidate, it's url safe but it's not exactly filename safe: Windows won't allow a file name which ends with a trailing dot

c# websocketServer base64乱码

我的未来我决定 提交于 2019-12-24 11:01:04
下载地址: https://download.csdn.net/download/peiranshuiyu/10168136 这个接收图片base64乱码,后来查原因: byte[102400]的参数,太短不能完整接收,太长又乱码,后来调成102400就好了, 奇怪哉也。 Socket SockeServer = (Socket)socket.AsyncState; // 在原始套接字上调用EndAccept方法,返回新的套接字 Socket SockeClient = SockeServer.EndAccept(socket); byte[] buffer = new byte[102400]; try { //接收客户端的数据 SockeClient.BeginReceive(buffer, 0, buffer.Length, SocketFlags.None, new AsyncCallback(Recieve), SockeClient); //保存登录的客户端 Session session = new Session(); session.SockeClient = SockeClient; session.IP = SockeClient.RemoteEndPoint.ToString(); session.buffer = buffer; lock

js逆向微博案例

喜欢而已 提交于 2019-12-24 06:41:07
js逆向 js逆向就是从网页的js找到加密的参数,实现破解加密,拿到cookie 微博登录案例 手动操作流程 访问首页https://weibo.com 输入用户名和密码 点击登录 如果有验证码,就输入验证码验证 成功跳转到微博首页面 1.请求分析 请求回的响应是否包含cookie,也即是看首页面的响应头中是否包含set-cookie。如果包含,那么这个请求是登录过程中必须的。经过查看,发现在首页面的响应头中,包含set-cookie,这个请求是登录的第一个请求。 2.寻找请求数据 第一次的请求 第二次的请求 观察data的变化,发现除了最后有个时间戳解决浏览器缓存之外,其他参数都是固定的。 nonce,pwencode,rsakv,以及sp的值都明确指明了参数被js加密了 一个servertime ertime 时间戳不管它,一个su,预测u就是username,一个sp,p应该是sp 3. 寻找加密的js 根据经验,在请求页面的html之后,还会去请求页面中的js,css,图片等信息。css,图片信息我们可以排除,一般情况,不会是登录的必须请求。一种常见的手法是,将后续请求需要用到的参数放到js中,然后通过js异步请求来完成登录。所以,我们在Network中过滤出所有的js请求。排除一些功能性的js,例如jquery之类,找出可能是参数的js。 https://login

C# Base64 Validation

对着背影说爱祢 提交于 2019-12-24 06:38:06
问题 I am receiving a base64 encoded file in my MVC controller's action from an AJAX request. Now I want to validate the base64 encodedstring. I want to allow only PDF, JPG and PNG formats. How can I validate the base64 encoded string on the server-side, so it will not take any other type of base64 encoded files, e.g. docx , exe etc.? I want to perform server-side validation on that regardless of Javascript validation. As you may know it may be hacked. Below is the base64 encoded version of an exe