【问题标题】:Using GNU Radio scrambler and descrambler使用 GNU Radio 加扰器和解扰器
【发布时间】:2019-05-14 08:16:07
【问题描述】:

我正在尝试使用 GNU Radio 解扰块。我有一个由第三方编写的块,需要解扰。使用的多项式是 x17 + x12 + 1。

代码如下

descrambler_cc_impl::descrambler_cc_impl()
  : gr::sync_block("descrambler_cc",
          gr::io_signature::make(1, 1, sizeof(unsigned char)),
          gr::io_signature::make(1, 1, sizeof(unsigned char)))
{
    lsr = 0;
}

/*
 * Our virtual destructor.
 */
descrambler_cc_impl::~descrambler_cc_impl()
{
}

int
descrambler_cc_impl::work(int noutput_items,
    gr_vector_const_void_star &input_items,
    gr_vector_void_star &output_items)
{
  const unsigned char *in = (const unsigned char *) input_items[0];
  unsigned char *out = (unsigned char *) output_items[0];
  int i;
  for (i = 0; i < noutput_items; i++) {
out[i] = (lsr & 1) ^ ((lsr >> 12) & 1) ^ ((lsr >> 17) & 1);
lsr = lsr << 1;
lsr = lsr | (in[i] & 1);
  }

  // Tell runtime system how many output items we produced.
  return i;
}

现在我想使用 GNU Radio 解扰器块。从
this link,我计算解扰参数如下:Mask - 0x0210001;种子 - 0x00;长度 - 24。

不幸的是,它不能作为上面显示的代码中的对应物。有人可以就为什么这不起作用提供指导吗?

【问题讨论】:

  • 能否为您的链接添加一个合适的名称?还有“第三方”:它来自哪里?它遵循一个非常不寻常的命名方案:_cc 表示“复杂输入,复杂输出”,而您所拥有的是“字节输入,字节输出”,它被称为_bb
  • 另外,解释一下你是如何得出长度和系数的。这些参数是在外部指定的,还是从源代码中读取的?
  • 另外,你的面具不可能是正确的;移动 17 位不会超过三个字节。
  • 另外,请确保您不会误解现有源代码中的位移位;此 LFSR 向左移动! GNU Radio 的 LFSR 右移。
  • 我承认使用的约定应该是 _bb 而不是 _cc。这是作者的错误。我通过链接中的示例计算了掩码。即 x^4 + x^3 + x^0 = 0x19 * x^5 + x^3 + x^0 = 0x29 * x^6 + x^5 + x^0 = 0x61 。我假设由于掩码的顺序为 17,因此您至少需要 3 个字节 = 24 位。使用的多项式是 G3RUH/K9NG [(x^17 + x^12 + 1)]

标签: gnuradio gnuradio-companion


【解决方案1】:

抱歉,答案更新迟了。下面的解释将清除一切

GNU Radio 块解扰器实现了给定掩码、种子和 长度。可以从加扰多项式计算掩码。在 GNU Radio 中,多项式有 在计算掩码之前以 little-endian 位顺序写入。对于上面的多项式p(x) = x^17 + x^12 + 1,掩码是通过首先排列较低幂的系数来计算的,即coef(x^1), coef(X^2) ... coef(x^17) for p(x) above。如下图所示:

mask = 0000 0000 0010 0001 = 0x0021.

从这个block的源码可以推导出这个上下文中的length就是一个移位寄存器的位数 插入新位时需要移位。因此,长度可以计算为

length = deg (p (x)) − 1

在我们的例子中,17 - 1 = 16。

【讨论】:

    猜你喜欢
    • 2021-07-22
    • 2017-03-22
    • 2021-05-11
    • 1970-01-01
    • 1970-01-01
    • 2013-06-27
    • 2019-09-25
    • 2016-09-22
    • 1970-01-01
    相关资源
    最近更新 更多