Encoding and Decoding Base64 Strings in Python

0
13K

The Base64 encoding is used to convert bytes that have binary or text data into ASCII characters. Encoding prevents the data from getting corrupted when it is transferred or processed through a text-only system. In this article, we will discuss about Base64 encoding and decoding and its uses to encode and decode binary and text data. Each Base64 character represents 6 bits of data. it is also important to note that it is not meant for encryption for obvious reasons.

 

import base64
  
sample_string = "Hello world!"
sample_string_bytes = sample_string.encode("ascii")
  
base64_bytes = base64.b64encode(sample_string_bytes)
base64_string = base64_bytes.decode("ascii")
  
print(base64_string)
Cerca
Categorie
Leggi tutto
Телевидение
Kavkaz Music TV. Прямой эфир.
KAVKAZ Music - этнический лейбл, представляющий национальную музыку народов Большого Кавказа....
By Nikolai Pokryshkin 2022-11-04 17:40:32 0 35K
Agriculture
Three types of Rocks
The 3 Different Names Of Rocks With Examples  Whether you’re an avid rockhound or...
By FWhoop Xelqua 2023-05-13 21:08:36 0 23K
Business
The Conversion Optimization Process: From Analysis to Results
Conversion Rate Optimization (CRO) is one of the most powerful disciplines in digital marketing....
By Dacey Rankins 2025-09-11 16:24:57 0 3K
Science Fiction and Fantasy
The Lord of the Rings: The Fellowship of the Ring.(2001)
A meek Hobbit from the Shire and eight companions set out on a journey to destroy the powerful...
By Leonard Pokrovski 2022-11-07 19:54:46 0 26K
Performing Arts
The Performing Arts: Celebrating Human Expression and Creativity
The performing arts are an essential part of human culture, offering a platform for individuals...
By Dacey Rankins 2024-11-08 16:54:45 0 12K

BigMoney.VIP Powered by Hosting Pokrov