Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Decrypt Values from Sharpoint List

Hello, I just started in the world of Power BI and now im facing a challenge. In a sharepoint list I am storing values which are encrypted using a function within MS Access. Now I want to use this ...
  • artemus's avatar
    artemus
    5 years ago

    Looks like I didn't properly translate the VBA text offset with the Power Query offset.

     

    This should work:

    = (DataIn as text) as text =>
    let
       asBinary = Binary.FromText(DataIn, BinaryEncoding.Hex),
       numbers = Binary.ToList(asBinary),
       xored = List.Transform({0 .. List.Count(numbers) - 1}, each 
          Number.BitwiseXor(numbers{_}, Character.ToNumber(Text.At(CodeKey, Number.Mod(_ + 1, Text.Length(CodeKey)))))
       ),
       asDecodedBinary = Binary.FromList(xored),
       asText = Text.FromBinary(asDecodedBinary, TextEncoding.Ascii)
    in
       asText