Windows Phone 8和Windows Store 8的随机数? [英] Random numbers for Windows Phone 8 and Windows Store 8?

查看:132
本文介绍了Windows Phone 8和Windows Store 8的随机数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为Windows Phone 8和Windows Store 8平台的几个安全库提供端口.我需要一个提供随机数的函数.

I'm struggling with a port of a couple of security libraries to the Windows Phone 8 and Windows Store 8 platform. I need a function which provides random numbers.

Win32具有CryptGenRandom甚至RtlGenRandom. Windows Store 10和Universal Windows具有BCryptGenRandom.但是,Windows Phone 8和Windows Store 8存在一个漏洞,因为CryptoAPI在 不可用,而CNG在Windows 10和Universal Windows上仅可用. MSDN文档说BCryptGenRandom可用于"Windows应用商店",但他们没有说它的Windows应用商店10和UWP(感谢CW ).

Win32 has CryptGenRandom and even RtlGenRandom. Windows Store 10 and Universal Windows has BCryptGenRandom. However, there's a hole for Windows Phone 8 and Windows Store 8 because CryptoAPI is not available, and CNG is only available on Windows 10 and Universal Windows. The MSDN docs say BCryptGenRandom is available for "Windows Store", but they don't say its Windows Store 10 and UWP (thanks CW).

这些库是不受管的C/C ++.它们用标准/便携式C和C ++编写.有时,他们必须使用特定于OS的API,例如用于收集随机数的API.它们不针对托管API进行编译,也不链接至托管库.

The libraries are unmanaged C/C++. They are written in standard/portable C and C++. On occasion, they have to use a OS specific API like those for gathering random number. They don't compile against managed APIs, and they don't link to managed libraries.

我们将Windows Phone 8和Windows Store 8的随机数用于什么?

What do we use for random numbers for Windows Phone 8 and Windows Store 8?

推荐答案

在WP8.1和Windows 8+中,我们使用的是

In WP8.1 and Windows 8+ we are using CryptographicBuffer.GenerateRandomNumber

这篇关于Windows Phone 8和Windows Store 8的随机数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆