On October 16, at about 8 PM CDT, YouTube went down. Visitors of the site were presented with the following "Internal Server Error" page:
This page presented the user with some information (the full text from this screenshot is here) that they could give to the YouTube support team, which is encoded in some form.
It appears to have 64 different possible characters [a-zA-Z0-9\-_], which seems to suggest that it could be a modified form of base64. However, when I tried replacing
/ as well as the other way around, I was unable to produce any meaningful data.1, 2
Can anyone tell what form of binary-to-text encoding this is?
/produced technically valid base64 input while replacing
+did not. Could be just a fluke, though.
2. I tried using
file to detect the file type. There are definitely other ways that I'm not aware of.
I wonder if someone know how to convert the depth map of google street view (encoded as base64) into an image or a 2D matrix. I'm using Python and was able to get the base64 string, decode it and save it to a .png file. However, the exported png file cannot be open by any graphic viewer... I guess the base64 code wasn't decoded correctly...
Here is a post that mentioned the base64 string in GSV.
Here is my code:
#URL of the json file of a GSV depth mapurl_depthmap='http://maps.google.com/cbk?output=json&cb_client=maps_sv&v=4&dm=1&pm=1&ph=1&hl=en&panoid=lcptgwtxfJ6DccSzyWp0zA'# getting the json filer = requests.get(url_depthmap)# open itdepth_json= r.json()# get the base64 string of the depth mapdata=depth_json['model']['depth_map']# fix the 'inccorrect padding' error. The length of the string needs to be divisible by 4.data += "=" * ((4 - len(data) % 4) % 4)# convert the URL safe format to regular format.data=data.replace('-','+').replace('_','/')data = base64.decodestring(data) # decode the stringdata=zlib.decompress(data) #decompress the data# write it to a png fileimage_result = open('downloads/deer_decode.png', 'wb')image_result.write(data)
This question already has an answer here:
I was implementing password hashing with salt, so I generated salt as binary, hashed the password, base64 encoded the password and salt then stored them into database.
Now when I am checking password, I am supposed to decode the salt back into binary data, use it to hash the supplied password, base64 encode the result and check if the result matches the one in database.
The problem is, I cannot find a method to decode the salt back into binary data. I encoded them using the Buffer.toString method but there doesn't seem to be reverse function.
I need to save a params file in python and this params file contains some parameters that I won't leave on plain text, so I codify the entire file to base64 (I know that this isn't the most secure encoding of the world but it works for the kind of data that I need to use).
With the encoding, everything works well. I encode the content of my file (a simply txt with a proper extension) and save the file. The problem comes with the decode. I print the text coded before save the file and the text coded from the file saved and there are exactly the same, but for a reason I don't know, the decode of the text of the file saved returns me this error
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8d in position 1: invalid start byte and the decode of the text before save the file works well.
Any idea to resolve this issue?
This is my code, I have tried converting all to bytes, to string, and everything...
params = open('params.bpr','r').read()paramsencoded = base64.b64encode(bytes(params,'utf-8'))print(paramsencoded)paramsdecoded = str(base64.b64decode(str(paramsencoded,'utf-8')),'utf-8')newparams = open('paramsencoded.bpr','w+',encoding='utf-8')newparams.write(str(paramsencoded))newparams.close()params2 = open('paramsencoded.bpr',encoding='utf-8').read()print(params2)paramsdecoded = str(base64.b64decode(str(paramsencoded,'utf-8')),'utf-8')paramsdecoded = base64.b64decode(str(params2))print(str(paramsdecoded,'utf-8'))
How can I decode a base64 string in Node.js that was encoded in PHP like:
base64_encode(openssl_encrypt ('password', "AES-256-CBC", 'keyforthepassword', OPENSSL_RAW_DATA, '6114'))
6114 is an ID of a person.
To decode this in PHP, I would run:
openssl_decrypt(base64_decode ('encoded_password'), "AES-256-CBC", 'keyforthepassword', OPENSSL_RAW_DATA, '6114')
How can I do the above decrypting in Node.js?