You are on a right way, but obviously you use indirection on local variables in block environment.

the wrong way:

Method testErr()
{
   set myvar(1)=123, ref=$na(myvar)
   set ref=$query(@ref)  -->  this gives you always: ref=""
}

The correct way

Method testOK() [ PublicList = myvar]
{
   new myvar
   set myvar(1)=123, ref=$name(myvar)
   set ref=$query(@ref) 
   write ref," ",@ref ---> myvar(1)," ",123
}

i.e. indirection needs variables with global scope

First, resetting a password means, the user gets a new password, in your use case, this is not an option.

Second, if you want (for whatever reason)  to validate the user in some stage of the application, then you must calculate the PBKDF2 from useres input (the password) and from (the stored) salt. The hash you get should be equal to the hash, storted in the database. PBKDF2 is a one way salted password hash.

By the way, you have to care about not to transfer the users (clear text) input to your computation over an unsecure way!

I think, the $zconvert() function will cover only the necessary entities. But you can use a simple method to convert characters to currently known(*) entities.

ClassMethod ToHTML(str)
{
   for i=$length(str):-1:1 set c=$ascii(str,i) set:$data(^entityChars(0,c),c) $extract(str,i)=c
   quit str
}

ClassMethod FromHTML(str)
{
   set i=0
   while $locate(str,"&[A-Za-z]+;",i,j,v) {
   set:$data(^entityChars(1,v),c) s=$length(v), $extract(str,j-s,j-1)=$c(c), j=j-s+1
   set i=j
   }
   quit str
}

I have a table (the ^entityChars() global) which contains more the 1400 entities. You can download the above class, together with the table from my FTP server (File: DC.Entity.xml):

Adr: ftp.kavay.at
Usr: dcmember
Psw: member-of-DC

A sample output:

USER>write ##class(DC.Entity).ToHTML("Flávio Lúcio Naves Júnior")
Flávio Lúcio Naves Júnior
USER>write ##class(DC.Entity).FromHTML("Flávio Lúcio Naves Júnior")
Flávio Lúcio Naves Júnior

(*) Currently known, because (1) I do not have all the currently known entities in my table and (2) with each new day, the W3C and the Unicode consortium can extend the current entity list.

First of all, if you want to transform a hex string into base64 (or whatever), then first you have to say, WHAT IS that hex string?

According to your example

set hexString = "4C5803040101020179C3913EC3BA7C4C580708010101021824584D4C"

the string has 56 hex chars, so if you decode those 56 hex chars, the resulting string could be:
a) 28 eigth bit characters or
b) 14 sixteen bit chars or even
c)  7 characters, each 32 bits wide.

For cases b) and c) you also have to define the endianness (big- or little-endian).

Second, I assume, your hex-string represents 8-bit chars, so we get 28 characters after converting the hex-chars into a string.

Converting to base64 means, you get for every 3 (8bit) chars four printable (8bit) chars.

We add two padding chars to the 28 byte string, so we have 30 chars,  now which are divisible by 3. This gives you  40 base64 encoded characters. But your Base64 encoding has 44 characters, which must be wrong.

Here is a simple and working solution:

Class DC.Util Extends %RegisteredObject
{
/// Hex to Base64
ClassMethod HexToB64(hex)
{
   if $length(hex)#2 zt "ELEN" // trap, two hex chars should make up each byte
   set str=""
   for i=1:2:$length(hex) set str=str_$char($zhex($extract(hex,i,i+1)))
   quit $system.Encryption.Base64Encode(str,1)
}
/// Base64 to Hex
ClassMethod B64ToHex(b64)
{
   set str=$system.Encryption.Base64Decode(b64), hex=""
   for i=1:1:$length(str) set hex=hex_$extract($zhex($ascii(str,i)+256),2,3)
   quit hex
}
}

and a short test

set hexString = "4C5803040101020179C3913EC3BA7C4C580708010101021824584D4C"
set b64String=##class(DC.Util).HexToB64(hexString)
write b64String, !, ##class(DC.Util).B64ToHex(b64String), !,hexString

TFgDBAEBAgF5w5E+w7p8TFgHCAEBAQIYJFhNTA==
4C5803040101020179C3913EC3BA7C4C580708010101021824584D4C
4C5803040101020179C3913EC3BA7C4C580708010101021824584D4C

For such a task, the Horner's method was introduced. Fast and simple.

ClassMethod BinToDec(bin)
{
   if $translate(bin,10)="" { // formal check, bin should only contain '1' and '0'
      set res=0
      for i=1:1:$length(bin) set res=res*2+$extract(bin,i)
      quit res
   } else { ztrap "NBIN" }
}


Hardcore ObjectScript programer place those few commands into one line

bin2dec(bin) { s res=0 f i=1:1:$l(bin) { s res=res*2+$e(bin,i) } q res }


and doesn't care about errors ;-))

Just a hint, I would take $ZD($h,2). For today, my development system (and systems at customers site) shows:

Write $horolog - $zdate($horolog, 4) + 1 --> 65925.93
Write $zdate($horolog,4) --> 20.07.2021
Write $horolog - $zdate($horolog, 2) + 1  --> 65926 // expected value

Later, this value (65925.93), as a $zdate() argument,  gives you an <ILLEGAL VALUE> 

For $zdate($horolog,4), the link you provided says:

4 DD/MM/[YY]YY (01/07/97 or 27/03/2002) — European numeric format. You must specify the correct dateseparator character (/ or .) for the current locale.

Obviously, the response.Data does not contain valid JSON. You can simply check the received data by putting the data aside in a temporary global, something like this:

do request.HttpResponse.Data.Rewind()
set ^temp.debug($j,"size")=request.HttpResponse.Data.Size
set ^("data")=request.HttpResponse.Data.Read(request.HttpResponse.Data.Size)  // or just the first 1000 bytes
zw ^temp.debug

Now you can take a look on the incoming data, maybe there is an encoding problem or the data do not adhere to JSON specification

According to your code,  the variable obx5 contains the base64 encoded tiff image. There is one thing I do not understand: what are those "\.br\" char-sequences, how they came into the base64 stream?

Anyway, I suppose they are OK (those "\.br\"s), so put all those pieces together and decode all at once:

set input = ""
for i=1:1:$L(obx5,"\.br\") { set input = input _ $P(obx5,"\.br\",i)) }

Do obj.Write($system.Encryption.Base64Decode(input))

Now you should have a correct decoded image, provided, the obx5 variable really contains the original base64 encoded tiff image with randomly inserted "\.br\" chars (for whatever reason).

Somehow I don't get you right. To save obj.%Size() in a variable, just do a simple assign

set myVariable = obj.%Size()

but I'm pretty shure, this was not your intended question.

I suppose, you have JSON formatted data (a string or a stream) and you want to store those data in a table. Am I right?

If yes, then follow the next steps:

1) create a class which describes your JSON objects (strings)

Class DC.SehindeRaji Extends (%Persistent, %JSON.Adaptor)
{
Property byr As %String(%JSONFIELDNAME = "byr:");
Property iyr As %String(%JSONFIELDNAME = "iyr:");
Property eyr As %String(%JSONFIELDNAME = "eyr:");
// do the same for all other fields

ClassMethod Import(data)
{
    set obj=..%New()                    // create a new DC.SehindeRaji object
    set sts=obj.%JSONImport(data,"")    // import the (JSON) data
    
    if sts {
        set sts = obj.%Save()
        if sts {
            write "Saved, ID=",obj.%Id(),!
            quit 1
            
        } else {
            write "Not saved, Err=",$system.Status.GetOneErrorText(sts),!
            quit 0
        }
        
    } else {
        write "Can't import: ",$system.Status.GetOneErrorText(sts),!
        quit 0
    }
}
}

2) You can create some test data (interactively) in a terminal session

set dynObj = {"byr:":"1937", "iyr:":"2017", "eyr:":"2020"}
set data = dynObj.%ToJSON()

or get your data somehow from an input (possibly from a file),  the only important thing is, your data should look like this

write data  -->  {"byr:":"1937","iyr:":"2017","eyr:":"2020"}

3) import those data

write ##class(DC.SehindeRaji).Import(data) --> Saved, ID=1

4) Now open the saved data and check the result

set oref =  ##class(DC.SehindeRaji).%OpenId(1)

write oref.byr  --> 1937
write oref.iyr  --> 2017

write oref.%JSONExportToString(.exported,"") --> 1
write exported  --> {"byr:":"1937","iyr:":"2017","eyr:":"2020"}

zw ^DC.SehindeRajiD
^DC.SehindeRajiD=1
^DC.SehindeRajiD(1)=$lb("","1937","2017","2020")

I hope, this is what yoy want to do...

The facts:
1) According to the error message: "The system cannot find the file specified."
2) Futhermore, the error message shows slashes and backslashes, mixing is rarely good, Windows uses "\", Unix "/"

What to do is:
1) check the filename, you want to send (including the path)
2) check the existence of the file
3) Under which user accont is IRIS/Cache running?
4) May this user read the file?

If you can call a JavaScript function, then you could do something like this...

<html>
<head><title>Test</title>
<link id="fav" rel="icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAABnRSTlMAAAAAAABupgeRAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAF0lEQVQokWP8z0AaYCJR/aiGUQ1DSAMAQC4BH5CRCM8AAAAASUVORK5CYII=">

<script>
    function changeFavicon() {
        var lid=document.getElementById("fav");
        if (lid) {
            lid.setAttribute("href","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAABnRSTlMAAAAAAABupgeRAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAGElEQVQokWNk+M9AEmAiTfmohlENQ0kDAD8vAR+xLJsiAAAAAElFTkSuQmCC");
        }
    }
</script>
</head>
<body>
<button onclick="changeFavicon();")>Change my favicon</button><br>
</body>
</html>

The (red and green) icons are just a demo example.