小编cam*_*ecc的帖子

在常春藤桥上RDRAND的耗尽特征是什么?

在查看英特尔数字随机数发生器(DRNG)软件实施指南之后,我对RDRAND调用时生成器的内部状态会发生什么问题提出了一些问题.不幸的是,答案似乎不在指南中.

  1. 根据该指南,在DRNG内部有四个128位缓冲器,用于提供随机位以RDRAND进行漏极.RDRAND本身将提供16位,32位或64位随机数据​​,具体取决于目标寄存器的宽度:

    rdrand ax   ; put 16 random bits in ax
    rdrand eax  ; put 32 random bits in eax
    rdrand rax  ; put 64 random bits in rax
    
    Run Code Online (Sandbox Code Playgroud)

    使用更大的目标寄存器会更快地清空这些128位缓冲区吗?例如,如果我只需要2位随机性,那么我是否应该经历在64位寄存器上使用16位寄存器的麻烦?这会对DRNG的吞吐量产生任何影响吗?我想避免消耗比必要更多的随机性.

  2. 指南说执行后将设置进位标志RDRAND:

    CF = 1   Destination register valid. Non-zero random value
             available at time of execution. Result placed in register.
    CF = 0   Destination register all zeros. Random value not available
             at time of execution. May be retried.
    
    Run Code Online (Sandbox Code Playgroud)

    "不可用"是什么意思?随机数据是否可用,因为RDRAND调用过快地耗尽了这些128位缓冲区?或者不可用意味着DRNG未通过健康检查而无法生成任何新数据?基本上,我试图理解CF …

x86 assembly x86-64 intel rdrand

12
推荐指数
2
解决办法
1436
查看次数

NIO2:如何将 URI 映射到路径?

我正在尝试找到一种简单的方法来将 a 映射URI到 a Path,而无需编写特定于任何特定文件系统的代码。以下似乎可行,但需要一种有问题的技术:

public void process(URI uri) throws IOException {
    try {
        // First try getting a path via existing file systems. (default fs)
        Path path = Paths.get(uri);
        doSomething(uri, path);
    }
    catch (FileSystemNotFoundException e) {
        // No existing file system, so try creating one. (jars, zips, etc.)
        Map<String, ?> env = Collections.emptyMap();
        try (FileSystem fs = FileSystems.newFileSystem(uri, env)) {
            Path path = fs.provider().getPath(uri);  // yuck :(
            // assert path.getFileSystem() == fs;
            doSomething(uri, path);
        }
    } …
Run Code Online (Sandbox Code Playgroud)

java filesystems zip jar nio2

4
推荐指数
1
解决办法
3077
查看次数

标签 统计

assembly ×1

filesystems ×1

intel ×1

jar ×1

java ×1

nio2 ×1

rdrand ×1

x86 ×1

x86-64 ×1

zip ×1