IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
AESCrypt.cs
Go to the documentation of this file.
1using System;
3using System.Runtime.InteropServices;
5
7{
8
13 [HideFromJava]
14 internal static class AESCrypt
15 {
16
28 [MethodImpl(MethodImplOptions.AggressiveInlining)]
29 public static bool DecryptBlock(byte[] @in, int inOffset, byte[] @out, int outOffset, int[] K)
30 {
31#if FIRST_PASS
32 throw new NotImplementedException();
33#else
34#if NETCOREAPP3_0_OR_GREATER
35 if (AESCrypt_x86.IsSupported)
36 {
37 AESCrypt_x86.DecryptBlock(@in.AsSpan(inOffset), @out.AsSpan(outOffset), K);
38 return true;
39 }
40
41#if NET6_0_OR_GREATER
42 if (AESCrypt_Arm.IsSupported)
43 {
44 AESCrypt_Arm.DecryptBlock(@in.AsSpan(inOffset), @out.AsSpan(outOffset), K);
45 return true;
46 }
47#endif
48#endif
49
50 return false;
51#endif
52 }
53
65 [MethodImpl(MethodImplOptions.AggressiveInlining)]
66 public static bool EncryptBlock(byte[] @in, int inOffset, byte[] @out, int outOffset, int[] K)
67 {
68#if FIRST_PASS
69 throw new NotImplementedException();
70#else
71#if NETCOREAPP3_0_OR_GREATER
72 if (AESCrypt_x86.IsSupported)
73 {
74 AESCrypt_x86.EncryptBlock(@in.AsSpan(inOffset), @out.AsSpan(outOffset), K);
75 return true;
76 }
77
78#if NET6_0_OR_GREATER
79 if (AESCrypt_Arm.IsSupported)
80 {
81 AESCrypt_Arm.EncryptBlock(@in.AsSpan(inOffset), @out.AsSpan(outOffset), K);
82 return true;
83 }
84#endif
85#endif
86
87 return false;
88#endif
89 }
90
91 }
92
93}