Re: BASE64 Decode / EPOCH Conversion Code Samples
On Sat, 9 Mar 2024 at 22:13, Paul Gilmartin < 042bfe9c879d-dmarc-requ...@listserv.ua.edu> wrote: [...] > Has anyone written a HLASM base64 decoder that works on both ASCII and > EBCDIC? > Well in a different sense. I wrote (and posted on ASSEMBLER-LIST a good many years ago) an HLASM macro that is essentially a DC instruction for base64. That is, you pass it a constant string and it assembles it into a base64 representation. I later added an ASCII conversion option (with default CP 819) because the OP had wanted to have the input strings treated as ASCII. With hindsight I should have used more descriptive variable names, but the whole thing is only about 50 lines, so not too bad to read. Plus another 264 lines for the Rexx-generated conversion table if you want it. Wow - I just looked it up on the list archives at listserv.uga.edu, and it was posted on Thu, 14 Mar 2002 12:34:32 -0500- so just a few days shy of 22 years ago. Something to think about for those who want to move these listserv lists to "modern" platforms like discord or stack exchange, or even groups.io or some IBM hosted list. What chance that a 22 year old post would still be around on one of those...? Tony H. -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: BASE64 Decode / EPOCH Conversion Code Samples
There seems to be confusion about what Base64 (jeez, I keep typing "54" or "65"!) encoding is. It's just what it sounds like: an encoding of characters using a 64-character* alphabet, i.e., six bits at a time. Hex '01020304' Base64-encodes to the same set of 8-bit characters whether ASCII or EBCDIC. "abcd" encodes to different characters depending on whether the input is EBCDIC or ASCII because the bytes (and thus the chunks of six bits0 are different. That means that if you Base64-encode an ASCII string, you can decode it on an EBCDIC platform (after translating the characters from ASCII to EBCDIC) and you get the original string-in ASCII. If you want translation, you need to translate before encoding or after decoding. So "Is there a bilingual [ASCII/EBCDIC] version of Base64" really doesn't make sense. *Although there are some slight variations. See https://en.wikipedia.org/wiki/Base64#Variants_summary_table if you're really bored. For the character geeks out there, there's a Unicode Base32K that's normalization safe. That'll really make your head hurt. -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: BASE64 Decode / EPOCH Conversion Code Samples
On Sun, 10 Mar 2024 02:11:50 +, Seymour J Metz wrote: >HLASM. > I understand that on Linux HLASM translates ASCII source to EBCDIC on input and assembles that. Has anyone written a HLASM base64 decoder that works on both ASCII and EBCDIC? Conditional assembly? Dual path? Translation on input? -- gil -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: BASE64 Decode / EPOCH Conversion Code Samples
HLASM. -- Shmuel (Seymour J.) Metz http://mason.gmu.edu/~smetz3 עַם יִשְׂרָאֵל חַי נֵ֣צַח יִשְׂרָאֵ֔ל לֹ֥א יְשַׁקֵּ֖ר From: IBM Mainframe Discussion List on behalf of Paul Gilmartin <042bfe9c879d-dmarc-requ...@listserv.ua.edu> Sent: Saturday, March 9, 2024 3:34 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: BASE64 Decode / EPOCH Conversion Code Samples On Sat, 9 Mar 2024 19:47:13 +0200, Binyamin Dissen wrote: > >Actually not, as the base64 document survives character conversion. > I agree there's no loss of information. >An assembler routine running using EBCDIC will provide the same result (with >EBCDIC) as the routine running using ASCII with ASCII, i.e., 'A' translates to >the same binary code on both systems. > What assembler runs on both ASCII and EBCDIC systems? There's an ambiguity. If you don't know whether your base64 is represented in ASCII or EBCDIC, suppose it contains the character at code point x'4E'. You don't know whether that's an EBCDIC '+' or ASCII 'N'. It matters. -- gil -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: BASE64 Decode / EPOCH Conversion Code Samples
On Sat, 9 Mar 2024 14:34:35 -0600 Paul Gilmartin <042bfe9c879d-dmarc-requ...@listserv.ua.edu> wrote: :>There's an ambiguity. If you don't know whether your base64 is represented :>in ASCII or EBCDIC, suppose it contains the character at code point x'4E'. :>You don't know whether that's an EBCDIC '+' or ASCII 'N'. It matters. It is the character set of the platform. The base64 source is supposed to be transmitted as text so whichever platform receives it expects 'A' to be 'A' in their character set. -- Binyamin Dissen http://www.dissensoftware.com Director, Dissen Software, Bar & Grill - Israel -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: BASE64 Decode / EPOCH Conversion Code Samples
On Sat, 9 Mar 2024 19:47:13 +0200, Binyamin Dissen wrote: > >Actually not, as the base64 document survives character conversion. > I agree there's no loss of information. >An assembler routine running using EBCDIC will provide the same result (with >EBCDIC) as the routine running using ASCII with ASCII, i.e., 'A' translates to >the same binary code on both systems. > What assembler runs on both ASCII and EBCDIC systems? There's an ambiguity. If you don't know whether your base64 is represented in ASCII or EBCDIC, suppose it contains the character at code point x'4E'. You don't know whether that's an EBCDIC '+' or ASCII 'N'. It matters. -- gil -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: BASE64 Decode / EPOCH Conversion Code Samples
On Sat, 9 Mar 2024 00:21:32 -0600 Paul Gilmartin <042bfe9c879d-dmarc-requ...@listserv.ua.edu> wrote: :>>It is a means of converting binary data to commonly printable characters :>>(typically A-Z a-z 0-9 + /) that can then be shipped in a non-binary manner. :>To an assembler program it is almost certain to matter whether "A-Z a-z 0-9 + /" :>are in ASCII or EBCDIC representation. Actually not, as the base64 document survives character conversion. An assembler routine running using EBCDIC will provide the same result (with EBCDIC) as the routine running using ASCII with ASCII, i.e., 'A' translates to the same binary code on both systems. -- Binyamin Dissen http://www.dissensoftware.com Director, Dissen Software, Bar & Grill - Israel -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: BASE64 Decode / EPOCH Conversion Code Samples
On Sat, 9 Mar 2024 08:46:01 -0600, Joel C. Ewing wrote: >... >If you really want the BASE64 encoding to be in EBCDIC characters, and >also a conversion of a binary value to be interpreted and displayed in >EBCDIC, I would think it much more useful to keep these as two >independent routines. > If it were coded in a HLL as a 64-branch SWITCH statement, it would work alike on an ASCII platform with ASCII encoded input and on an EBCDIC platform with EBCDIC encoded input, producing identical binary output for both. An outboard ICONV filter might be useful. >>> On Wed, 6 Mar 2024 06:11:01 + Frank Bonaduce wrote: >>> >>> :>Hello Folks. Is anyone aware of where one might locate any sample >>> assembler code, macros or APIs to perform the following: >>> :>- Base64 Decoding (to EBCDIC)- EPOCH Conversion >>> :>Thanks in advance for the assistance.� �Frank. -- gil -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: BASE64 Decode / EPOCH Conversion Code Samples
Your requirement was confused by adding "epoch conversion". Sounded like you expected one routine to decode a BASE64-encoded string (which in most contexts is 7-bit ASCII as octets) interpret the binary as an epoch timestamp, and generate displayable EBCDIC characters. Now its sounds like you're looking a BASE64 encode/decode where the (presumably) same glyphs are used to represent the base-64 digits are EBCDIC rather than ASCII character codes. I suppose someone may have done that, but you would end up with octets that require all 8 bits to represent the characters, which would be a different goal than the original ASCII usage. If you really want the BASE64 encoding to be in EBCDIC characters, and also a conversion of a binary value to be interpreted and displayed in EBCDIC, I would think it much more useful to keep these as two independent routines. Joel C Ewing On 3/9/24 00:21, Paul Gilmartin wrote: On Wed, 6 Mar 2024 09:59:02 +0200, Binyamin Dissen wrote: Base64 has nothing to do with EBCDIC. ??? It is a means of converting binary data to commonly printable characters (typically A-Z a-z 0-9 + /) that can then be shipped in a non-binary manner. To an assembler program it is almost certain to matter whether "A-Z a-z 0-9 + /" are in ASCII or EBCDIC representation. A simple duck-duck-go search will show examples. My first C program was a base 64 converter. On Wed, 6 Mar 2024 06:11:01 + Frank Bonaduce wrote: :>Hello Folks. Is anyone aware of where one might locate any sample assembler code, macros or APIs to perform the following: :>- Base64 Decoding (to EBCDIC)- EPOCH Conversion :>Thanks in advance for the assistance.� �Frank. -- Joel C. Ewing -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: BASE64 Decode / EPOCH Conversion Code Samples
On Wed, 6 Mar 2024 09:59:02 +0200, Binyamin Dissen wrote: >Base64 has nothing to do with EBCDIC. > ??? >It is a means of converting binary data to commonly printable characters >(typically A-Z a-z 0-9 + /) that can then be shipped in a non-binary manner. > To an assembler program it is almost certain to matter whether "A-Z a-z 0-9 + /" are in ASCII or EBCDIC representation. >A simple duck-duck-go search will show examples. My first C program was a base >64 converter. > >On Wed, 6 Mar 2024 06:11:01 + Frank Bonaduce wrote: > >:>Hello Folks. Is anyone aware of where one might locate any sample assembler >code, macros or APIs to perform the following: >:>- Base64 Decoding (to EBCDIC)- EPOCH Conversion >:>Thanks in advance for the assistance.� �Frank. -- gil -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: BASE64 Decode / EPOCH Conversion Code Samples
Java has java.util.Base64.Decoder since 1.8. JRE should be available on USS On Tuesday, March 5, 2024 at 11:21:17 PM MST, Frank Bonaduce <05e50174f43c-dmarc-requ...@listserv.ua.edu> wrote: Hello Folks. Is anyone aware of where one might locate any sample assembler code, macros or APIs to perform the following: - Base64 Decoding (to EBCDIC)- EPOCH Conversion Thanks in advance for the assistance. Frank. -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: BASE64 Decode / EPOCH Conversion Code Samples
>>. Is anyone aware of where one might locate any sample assembler code, macros >>or APIs to perform the following: - Base64 Decoding (to EBCDIC)- EPOCH Conversion Thanks in advance for the assistance. Frank, Check this link for BASE64 decoding and encoding https://github.com/cicsdev/base64 EPOCH conversion is easy. Just convert EPOCH to TOD and use SYS1.MACLIB(STCKCONV) to convert it to readable date and time format. TOD = (epoc * 409600) + 90480181248 Thanks, Kolusu -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: BASE64 Decode / EPOCH Conversion Code Samples
Base64 has nothing to do with EBCDIC. It is a means of converting binary data to commonly printable characters (typically A-Z a-z 0-9 + /) that can then be shipped in a non-binary manner. A simple duck-duck-go search will show examples. My first C program was a base 64 converter. On Wed, 6 Mar 2024 06:11:01 + Frank Bonaduce <05e50174f43c-dmarc-requ...@listserv.ua.edu> wrote: :>Hello Folks. Is anyone aware of where one might locate any sample assembler code, macros or APIs to perform the following: :>- Base64 Decoding (to EBCDIC)- EPOCH Conversion :>Thanks in advance for the assistance. Frank. -- Binyamin Dissen http://www.dissensoftware.com Director, Dissen Software, Bar & Grill - Israel -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
BASE64 Decode / EPOCH Conversion Code Samples
Hello Folks. Is anyone aware of where one might locate any sample assembler code, macros or APIs to perform the following: - Base64 Decoding (to EBCDIC)- EPOCH Conversion Thanks in advance for the assistance. Frank. -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN