iOS 将 CFUUID 转换为 MAC 地址

发布于 2024-12-23 10:04:06 字数 422 浏览 3 评论 0原文

我知道 CFUUID 是根据 MA​​C 地址和其他一些内容生成的。那么有什么办法可以从 CFUUID 取回 MAC 地址吗?

我们有一些蓝牙设备,用户所知道的只是设备上写入的 MAC 地址的后 3 部分。因此,我们希望为用户提供选择正确设备的选项。在iOS端,看起来我们只有CFUUID。那么有没有办法将UUID转换回mac地址呢?

或者如果有办法的话那就更好了直接获取外围设备的 MAC 地址而不是 UUID,但似乎不可能

谢谢

I know CFUUID is generated from MAC address and a few other stuff. So is there anyways to get the MAC address back from CFUUID?

We have a few bluetooth devices and all the user knows is the last 3 parts of the MAC address which is written on the device. So we wanna give the user and option to select the right device. On the iOS side, looks like all we have the the CFUUID. So is there's a way to convert the UUID back to mac address?

Or even better would be if there's a way to get a peripheral's MAC address directly instead of UUID, but doesn't seem like that's possible

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

我们的影子 2024-12-30 10:04:06

好吧,正如您可能从对您的问题的评论中了解到的那样,答案显然是:不。 (实际上)不可能获得生成特定 UUID 的种子。假设事实上生成你的 UUID 的算法确实使用了你设备的 MAC 地址来生成它,我猜你不能保证你使用的 UUID 生成器就是这种情况,除非你有权访问 UUID 生成器代码或算法(UUID 版本 1可能?)并且这对你来说不是一个不透明的操作(立即违背了 uuid 生成算法的真正目的)。

当您说 UUID 的生成可能会使用设备的 MAC 地址时,您显然是在做某事,其他组件如时间戳、散列、UDID(iOS 设备)等。事实上,MAC 地址可能只是用于生成 UUID 的众多因素之一,因此,如果您花费大量计算能力来尝试从同一系统在同一系统下生成的 UUID 的大样本中解构它,条件相同;我们可能会谈论一台浪费计算能力的量子计算机,试图探索与可观测宇宙中的粒子一样多的组合,这样你就可以获得一个 MAC 地址,如果你愿意的话,你也可以从蓝牙外设中获得该地址,并顺便击败再次强调拥有 UUID 的目的。

另一方面,进一步回答有人对你的问题的评论:你觉得 UUID 如此无聊的原因是建立在上一段想法之上,这样你就可以避免冲突:生成重复项不仅仅是来自计算机生成的重复项但从每台设备每时每刻生成的所有其他服务(用于验证请求、在数据库中创建字符串索引键或识别服务和特征)中,这样您的酷服务或特征命名为:

AAAAAAAA-BBBB-CCCC-DDDD-EEEEFFFF6666 

不会与其他服务或特征混淆很酷的 foo 服务或具有相同特征的UUID。

一般来说,有关更多信息,请查看维基百科或仅查看核心蓝牙编程指南,形成开发人员门户。它仍处于 NDA 状态,因此您必须是具有有效开发人员计划凭据的注册 iOS 开发人员才能阅读它。

Well, as you might have learnt from the comments to your question, the answer is clearly: NO. It is not possible (practically) to get the seeds that generated a particular UUID. Provided that in fact the algorithm that generated your UUID did used the MAC Address of your device to generate it, and I guess you cannot guarantee that it is the case for the UUID generator you use, unless you have access to the UUID Generator code or algorithm (UUID Version 1 probably?) and it is not a opaque operation to you (Immediately defeating the very purpose of the uuid generation algorithm).

While you clearly are onto something when you say that the generation of a UUID might use the MAC address of the device, other components like timestamps, hashing, UDID (iOS Devices) and so on. The fact is that the MAC Address, could be just one of many factors used to generate the UUID so if you were to spend a lot of computing power into trying to deconstruct it out of a big sample of UUIDs generated by the same system under the same conditions; We will probably be talking about a quantum computer wasting computing power trying to explore as many combinations as particles in the observable universe so you get a MAC address that you may as well get as a characteristic from a Bluetooth peripheral if you like, and incidentally defeating the purpose of having a UUID in the first place, once more.

On the other hand, further to what somebody commented on your question: the reason you find UUIDs so boring, building on top of the previous paragraph idea, is so you can avoid collisions: Generating duplicates not just coming from the ones generated by your computer but from all the other ones generated by every device out there every moment of the day (to authenticate requests, create string index keys in a database, or identifying services and characteristics) so your cool service or characteristic named:

AAAAAAAA-BBBB-CCCC-DDDD-EEEEFFFF6666 

does not get confused with another cool foo service or characteristic with the same UUID.

In general, for more information check wikipedia or just the Core Bluetooth Programming Guide, form the developer portal. It is still under NDA so you have to be a registered iOS Developer with active developer program credentials to read it.

是你 2024-12-30 10:04:06

我一直在寻找一种部署独立于平台的 BLE 设备静态配置的方法。我感到灰心(Apple 的 UUID +/- 毫无意义,并且可以在大多数/所有其他平台上获取的 MAC/BDADDR 无法从 CoreBluetooth 访问)。幸运的是,我注意到“设备信息服务”配置文件 (0x180A) 包含一个“系统 ID”属性 (0x2A23),该属性对设备的唯一 MAC/BDADDR 地址进行编码。不过,我不知道 BLE 设备是否必须公开此服务。

I was looking for a way to deploy platform-independent, static configurations of BLE devices. I was getting discouraged (Apple's UUIDs are +/- meaningless, and the MAC/BDADDR which can be obtained on most/all other platforms is not accessible from CoreBluetooth). Fortunately, I noticed that the "Device Information Service" profile (0x180A) contains a "System ID" attribute (0x2A23) which encodes the device's unique MAC/BDADDR address. I don't know if it is mandatory for a BLE device to expose this service, however.

荒岛晴空 2024-12-30 10:04:06

有一种方法可以获取 ios 设备的 mac 地址。但仅适用于ios8及更高版本。没有私有 api 。https://github.com/Baoge2012/MacAddressLibDemo

there is a way to get mac address for ios device. but only works on ios8 and later. no private api .https://github.com/Baoge2012/MacAddressLibDemo

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文