• Need a Base64 Program

    From sschumacher@venturecomm.net@21:1/5 to All on Thu Mar 13 09:33:23 2025
    I have a need to Decode Bsse 64 books. What programs is used to do
    this?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Newyana2@21:1/5 to sschumacher@venturecomm.net on Thu Mar 13 12:11:05 2025
    On 3/13/2025 10:33 AM, sschumacher@venturecomm.net wrote:
    I have a need to Decode Bsse 64 books. What programs is used to do
    this?


    Books? Are you sure it's base64? That would be unusual and
    hard to justify. I keep VBScripts on my desktop for decoding
    Base64. It's fairly simple. But you'd need something more
    robust to decode 1,000,000+ characters in one operation.

    The gist of it is not complicated. Each 3 bytes is separated
    into 4 groups of 6 bits. Those can represent 0 to 63. By doing
    that, each 6-group can be represented by an ASCII text character,
    allowing binary data to be represented as plain text. It's mostly
    only used for things like embedding images in email or webpages.

    If you want the script I can post it, but if you want to use it
    for a large mass of text you'd probably need to break it up into
    chunks.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul@21:1/5 to sschumacher@venturecomm.net on Thu Mar 13 12:15:07 2025
    On Thu, 3/13/2025 10:33 AM, sschumacher@venturecomm.net wrote:
    I have a need to Decode Base 64 books. What programs is used to do
    this?


    Make sure you have the correct file type. UUEncoded files
    have the filename at the top of the file (you might need a different tool!). Raw BASE64 is just a blob. The BASE64 blob looks like this. I
    tried the Linux "file" command on this, and Linux cannot even tell
    me it is a BASE64 blob. You tell a BASE64 blob from an ASCII85
    blob, by the spectrum. There is no metadata in this example
    that says "I am a BASE64 blob". That is a supposition on my part.
    I hope I am right.

    JVBERi0xLjcKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZwovT3V0bGluZXMgMiAwIFIKL1Bh Z2VzIDMgMCBSID4+CmVuZG9iagoyIDAgb2JqCjw8IC9UeXBlIC9PdXRsaW5lcyAvQ291bnQg
    ...
    ZTZlMGM5YWQ3Pl0KPj4Kc3RhcnR4cmVmCjE4ODYKJSVFT0YK

    To decode a blob like that, you do this in Windows. My sample blob is
    stored in the file "sample-now-base64-encoded.txt". I am assuming
    the file is a PDF, but I can't be sure, since the blob has no metadata
    and I would have to do some forensic work to determine what the file
    really is. You should be careful in any case, with a blob given you
    by a stranger. For example, I could have "MyBook.pdf" from this command, scanned on virustotal.com if I wanted to know the danger level (but that's
    a pretty lazy way to do it).

    certutil -decodehex sample-now-base64-encoded.txt MyBook.pdf 1

    Input Length = 3188
    Output Length = 2358
    CertUtil: -decodehex command completed successfully.

    Now I could open "Mybook.pdf" by clicking on it, but I can only do that
    without reservation, because I made the "sample-now-base64-encoded.txt"
    and I know what is in there. The source material was a 3KB PDF file.

    The output file could easily contain another level of encoding that
    is not declared anywhere. That's why a lot of what you are about
    to do, relied on "trust, and proper documentation by the sender".

    Paul

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Newyana2@21:1/5 to Alan K. on Thu Mar 13 12:54:14 2025
    On 3/13/2025 12:37 PM, Alan K. wrote:

    If you want the script I can post it, but if you want to use it
    for a large mass of text you'd probably need to break it up into
    chunks.

    I wouldn't mind seeing that piece of code.  Thanks.


    As you may know, Base64 doesn't always end evenly, so there may
    sometimes be equal signs at the end to round it off. For that reason,
    if one wanted to decode blocks then they need to be a multiple of 4.
    Here's a version that uses FileSystemObject. What's not showing is the
    process of having FSO read in the text of a file. The Str64 parameter
    is the base64 string. Watch out for wordwrap.:

    Function DecodeBase64(Str64)
    Dim B1(), B2()
    Dim i1, i2, i3, LLen, UNum, s2, sRet, ANums
    Dim A255(255)
    On Error Resume Next
    ANums = Array(65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
    77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100,
    101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
    115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55,
    56, 57, 43, 47)

    For i1 = 0 To 255
    A255(i1) = 64
    Next
    For i1 = 0 To 63
    A255(ANums(i1)) = i1
    Next
    s2 = Replace(Str64, vbCr, "")
    s2 = Replace(s2, vbLf, "")
    s2 = Replace(s2, " ", "")
    s2 = Trim(s2)
    LLen = Len(s2)
    ReDim B1(LLen - 1)
    For i1 = 1 to LLen
    B1(i1 - 1) = Asc(Mid(s2, i1, 1))
    Next

    '--B1 is now in-string as array.
    ReDim B2((LLen \ 4) * 3 - 1)
    i2 = 0
    For i1 = 0 To UBound(B1) Step 4
    B2(i2) = (A255(B1(i1)) * 4) Or (A255(B1(i1 + 1)) \ 16)
    i2 = i2 + 1
    B2(i2) = (A255(B1(i1 + 1)) And 15) * 16 Or (A255(B1(i1 + 2)) \ 4)
    i2 = i2 + 1
    B2(i2) = (A255(B1(i1 + 2)) And 3) * 64 Or A255(B1(i1 + 3))
    i2 = i2 + 1
    Next
    If B1(LLen - 2) = 61 Then
    i2 = 2
    ElseIf B1(LLen - 1) = 61 Then
    i2 = 1
    Else
    i2 = 0
    End If
    UNum = UBound(B2) - i2
    ReDim Preserve B2(UNum)
    For i1 = 0 to UBound(B2)
    B2(i1) = Chr(B2(i1))
    Next
    DecodeBase64 = Join(B2, "")
    End Function

    This next one uses ADO, which is more efficient but is famously
    funky about reading in text. It's recommended to read in chunks
    of max size 128 KB. This one is the entire script, for encoding
    or decoding. So, for example, if you have a photo stored in an
    email, as long as you get that text cleanly, you can recreate the
    image file. The FSO version handles carriage returns. I don't remember
    about the ADO version. I expect it handles them internally.

    Dim ADO, XML, s1, A1, Arg, IfEncode, oNode, sFil

    Arg = WScript.Arguments(0)

    LRet = MsgBox("Click yes to encode file or no to decode.", 36)
    If LRet = 6 Then
    IfEncode = True
    Else
    IfEncode = False
    End If

    Set XML = CreateObject("Msxml2.DOMDocument")
    Set ADO = CreateObject("ADODB.Stream")

    If IfEncode = True Then
    With ADO
    .Open
    .Type = 1 'Binary
    .LoadFromFile Arg
    A1 = .Read
    .Close
    End With

    Set oNode = XML.CreateElement("El")
    oNode.DataType = "bin.base64"
    oNode.NodeTypedValue = A1
    s1 = oNode.Text
    Set oNode = Nothing

    With ADO
    .Open
    .Type = 2 'text
    .Charset = "windows-1252"
    .WriteText s1
    sFil = Arg & "-64.txt"
    .SaveToFile sFil, 2 'overwrite existing.
    .Close
    End With
    Else

    With ADO
    .Open
    .Type = 2 'text
    .Charset = "windows-1252"
    .LoadFromFile Arg
    Dim iA, A2()
    iA = 0
    ReDim A2(100)
    Do
    s1 = .ReadText(128000)
    If Len(s1) > 0 Then
    A2(iA) = s1
    Else
    Exit Do
    End If
    iA = iA + 1
    If iA mod 100 = 0 Then ReDim Preserve A2(iA + 100)
    Loop
    .Close
    End With
    s1 = Join(A2, "")

    Set oNode = XML.CreateElement("El")
    oNode.DataType = "bin.base64"
    oNode.Text = s1
    A1 = oNode.NodeTypedValue
    Set oNode = Nothing

    With ADO
    .Open
    .Type = 1 'binary
    .Write A1
    sFil = Arg & "-64.dat"
    .SaveToFile sFil, 2 'overwrite existing.
    .Close
    End With

    End If


    MsgBox "Done. Saved as " & vbCrLf & sFil

    Set ADO = Nothing
    Set XML = Nothing

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Alan K.@21:1/5 to All on Thu Mar 13 12:37:21 2025
    On 3/13/25 12:11 PM, Newyana2 wrote:
    On 3/13/2025 10:33 AM, sschumacher@venturecomm.net wrote:
    I have a need to Decode Bsse 64 books.  What programs is used to do
    this?


      Books? Are you sure it's base64? That would be unusual and
    hard to justify. I keep VBScripts on my desktop for decoding
    Base64. It's fairly simple. But you'd need something more
    robust to decode 1,000,000+ characters in one operation.

      The gist of it is not complicated. Each 3 bytes is separated
    into 4 groups of 6 bits. Those can represent 0 to 63. By doing
    that, each 6-group can be represented by an ASCII text character,
    allowing binary data to be represented as plain text. It's mostly
    only used for things like embedding images in email or webpages.

    If you want the script I can post it, but if you want to use it
    for a large mass of text you'd probably need to break it up into
    chunks.

    I wouldn't mind seeing that piece of code. Thanks.

    --
    Linux Mint 22.1, Cinnamon 6.4.8, Kernel 6.8.0-55-generic
    Thunderbird 128.8.0esr, Mozilla Firefox 136.0
    Alan K.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Herbert Kleebauer@21:1/5 to sschumacher@venturecomm.net on Thu Mar 13 17:52:03 2025
    On 13.03.2025 15:33, sschumacher@venturecomm.net wrote:

    I have a need to Decode Bsse 64 books. What programs is used to do
    this?

    certutil -decode /?

    certutil -decode infile outfile

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Newyana2@21:1/5 to Herbert Kleebauer on Thu Mar 13 15:05:01 2025
    On 3/13/2025 12:52 PM, Herbert Kleebauer wrote:
    On 13.03.2025 15:33, sschumacher@venturecomm.net wrote:

    I have a need to Decode Bsse 64 books.  What programs is used to do
    this?

    certutil -decode /?

    certutil -decode infile outfile


    That works. I didn't know about certutil.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From david@21:1/5 to Herbert Kleebauer on Thu Mar 13 15:39:15 2025
    Using <news:vqv2fk$3hdpa$1@dont-email.me>, Herbert Kleebauer wrote:

    I have a need to Decode Bsse 64 books. What programs is used to do
    this?

    certutil -decode /?

    certutil -decode infile outfile

    Decoding Base64 data on Windows can be achieved through various methods,
    both with dedicated software and through built-in tools. Here's a breakdown
    of common approaches:

    1. Online Tools:

    Base64.guru:
    This website (base64.guru) provides a user-friendly interface for decoding Base64 data, including files. It often allows for previews of
    decoded content, which is very helpful. This is a very good option for ease
    of use.
    Many other websites offer similar Base64 decoding functionality. A
    simple web search for "Base64 decode online" will provide many options.

    2. Windows Command-Line Tools:

    certutil:
    The certutil command-line utility, built into Windows, can decode Base64 data. This is a powerful option for those comfortable with the
    command line.
    Example usage: certutil -decode input.b64 output.file
    This command decodes the Base64 data in "input.b64" and saves
    the result to "output.file".
    Powershell:
    Powershell also has the capabilities to decode base 64.
    Example:
    [Convert]::FromBase64String("YourBase64StringHere") |
    Out-File -Encoding Byte "DecodedFile.bin"


    3. Third-Party Software:

    Base64 Tools:
    There are dedicated Base64 encoding/decoding software applications available for Windows. Some of these offer more advanced features and a graphical user interface.

    Text Editors:
    Some advanced text editors, like Notepad++, may have plugins or built-in functionalities for Base64 decoding.

    Important Considerations:

    File Type:
    Base64 is an encoding scheme, not a file format. Therefore, after decoding, you'll need to know the original file type (e.g., PDF, image,
    text) to open it correctly.

    Security:
    Be cautious when decoding Base64 data from untrusted sources, as it could contain malicious content. When using online tools, be aware of what information you are pasting into the web page.
    Command Line:
    Using the command line tools, provides a very secure way to decode files, as the information does not leave your local computer.

    I hope this information is helpful.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)