简体   繁体   English

在 ABAP 中处理二进制数据

[英]Working with binary data in ABAP

I'm trying to implement some cryptographic functions in ABAP, and I'm confused with low performance of operations on binary strings.我正在尝试在 ABAP 中实现一些加密函数,但我对二进制字符串操作的低性能感到困惑。

For example, I have a string of X (not XString) and I want to read it byte after byte in a loop.例如,我有一个 X 字符串(不是 XString),我想在循环中逐个字节地读取它。 I say:我说:

DO n TIMES.
  b = data+offset(1).
...

This works, but read speed is around 1.5 MB/s.这有效,但读取速度约为 1.5 MB/s。 Another operations including bitwise addition, circular shifts and modular additions are working slow as well.包括按位加法、循环移位和模加法在内的其他操作也运行缓慢。

As the result, I've got around 600 KB/s hashing speed in ABAP compared to ~100 MB/s in C/C++.结果,与 C/C++ 中的约 100 MB/s 相比,我在 ABAP 中获得了大约 600 KB/s 的散列速度。

I've got a doubt that ABAP is suitable for processing binary data.我怀疑 ABAP 是否适合处理二进制数据。 Maybe there are another idiomatic ways to handle binary data;也许还有另一种惯用的方式来处理二进制数据; or there's no way but extracting cryptographic functions into, let's say, C# or Java services?或者除了将加密函数提取到 C# 或 Java 服务之外别无他法?

As has been suggested, ABAP is not necessarily the best way to implement system-type functionality, not only for performance reasons but because handling certain data types in ABAP can be quite unwieldy at times.正如所建议的那样,ABAP 不一定是实现系统类型功能的最佳方式,这不仅是出于性能原因,还因为有时在 ABAP 中处理某些数据类型可能非常笨拙。

Perhaps you can implement your crypto functions in C and then interface to them from ABAP via RFC, with your C application acting as an RFC server and you calling it from ABAP via an RFC call.也许您可以在 C 中实现您的加密函数,然后通过 RFC 从 ABAP 连接到它们,您的 C 应用程序充当 RFC 服务器,您通过 RFC 调用从 ABAP 调用它。 You can find out more about installing the NetWeaver RFC SDK here and about writing an RFC server here .您可以在此处找到有关安装 NetWeaver RFC SDK 以及在此处编写 RFC 服务器的更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM