seo.base64_decode.how_desc
- seo.base64_decode.how_step1
- seo.base64_decode.how_step2
- seo.base64_decode.how_step3
- seo.base64_decode.how_step4
seo.base64_decode.how_example
فك تشفير سلاسل Base64 المشفرة إلى النص أو البيانات الأصلية.
فك تشفير Base64 هو العملية العكسية لترميز Base64. يحول نص ASCII المشفر بـ Base64 إلى تنسيقه الثنائي أو النصي الأصلي. تساعدك أداة فك التشفير هذه على فك تشفير سلاسل Base64 بسرعة دون أي معرفة بالبرمجة.
seo.base64_decode.how_desc
seo.base64_decode.how_example
يعكس فك تشفير Base64 التحويل الرياضي الذي يؤديه الترميز. بينما يحول الترميز كل 3 بايتات إلى 4 أحرف، يأخذ فك التشفير كل 4 أحرف Base64 ويحولها مرة أخرى إلى 3 بايتات. يفسر فك التشفير كل حرف وفقًا لأبجدية Base64 (A-Z = 0-25، a-z = 26-51، 0-9 = 52-61، + = 62، / = 63)، ويحولها إلى قيم 6 بت، ويربطها في كتل 24 بت، ويقسمها مرة أخرى إلى البايتات الأصلية 8 بت. تشير أحرف الحشو (=) إلى أن طول البيانات الأصلية لم يكن مضاعفًا لـ 3، مما يسمح لفك التشفير بقطع الإخراج بشكل صحيح.
فك تشفير Base64 قابل للعكس ولا يوفر أي أمان. يمكن لأي شخص فك تشفير سلاسل Base64. تعامل مع المحتوى المفكك كغير موثوق به ما لم يتم التحقق منه. تعرف على أمان الترميز
توفر معظم لغات البرمجة وظائف مدمجة لفك تشفير Base64. إليك أمثلة مع معالجة الأخطاء المناسبة:
// فك التشفير الأساسي
$decoded = base64_decode($encoded);
// فك التشفير مع الوضع الصارم (يتحقق من صحة الإدخال)
$decoded = base64_decode($encoded, true);
if ($decoded === false) {
// سلسلة Base64 غير صالحة
throw new Exception("Invalid Base64");
}
// فك التشفير إلى سلسلة UTF-8
$text = base64_decode($encoded, true);
if (!mb_check_encoding($text, 'UTF-8')) {
// ليست UTF-8 صالحة
}
// المتصفح (atob لـ ASCII فقط)
try {
const decoded = atob(encoded);
} catch (e) {
console.error("Invalid Base64:", e);
}
// المتصفح مع دعم UTF-8
function base64Decode(str) {
try {
return decodeURIComponent(escape(atob(str)));
} catch (e) {
throw new Error("Invalid Base64 or UTF-8");
}
}
import base64
# فك التشفير إلى بايتات
try:
decoded_bytes = base64.b64decode(encoded)
decoded_text = decoded_bytes.decode('utf-8')
except Exception as e:
print(f"Decoding failed: {e}")
# التحقق من صحة Base64 قبل فك التشفير
try:
decoded = base64.b64decode(encoded, validate=True)
except base64.binascii.Error:
print("Invalid Base64 string")
import (
"encoding/base64"
"fmt"
)
// فك تشفير Base64 القياسي
decoded, err := base64.StdEncoding.DecodeString(encoded)
if err != nil {
fmt.Println("Decoding error:", err)
return
}
// فك تشفير Base64 الآمن لعناوين URL (لـ JWT)
decoded, err := base64.URLEncoding.DecodeString(encoded)
if err != nil {
fmt.Println("Decoding error:", err)
}
import java.util.Base64;
import java.nio.charset.StandardCharsets;
// فك التشفير الأساسي
try {
byte[] decodedBytes = Base64.getDecoder().decode(encoded);
String decoded = new String(decodedBytes, StandardCharsets.UTF_8);
} catch (IllegalArgumentException e) {
System.err.println("Invalid Base64: " + e.getMessage());
}
// فك التشفير الآمن لعناوين URL
byte[] decoded = Base64.getUrlDecoder().decode(encoded);
require 'base64'
# فك التشفير الأساسي
begin
decoded = Base64.decode64(encoded)
rescue ArgumentError => e
puts "Invalid Base64: #{e.message}"
end
# فك التشفير الصارم (يتحقق من صحة الإدخال)
decoded = Base64.strict_decode64(encoded)
# فك التشفير الآمن لعناوين URL
decoded = Base64.urlsafe_decode64(encoded)
using System;
using System.Text;
// فك التشفير الأساسي
try
{
byte[] bytes = Convert.FromBase64String(encoded);
string decoded = Encoding.UTF8.GetString(bytes);
}
catch (FormatException ex)
{
Console.WriteLine($"Invalid Base64: {ex.Message}");
}
هل تحتاج إلى ترميز البيانات إلى Base64؟ استخدم مشفر Base64 لتحويل النص أو البيانات الثنائية إلى تنسيق Base64.
فك تشفير رموز JWT؟ يفك فك تشفير JWT الخاص بنا تلقائيًا جميع الأقسام الثلاثة ويعرض المطالبات بتنسيق قابل للقراءة.
تعمل مع بيانات مشفرة بـ URL؟ جرب فك تشفير URL لفك تشفير السلاسل المشفرة بالنسبة المئوية.